Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need ability to delete an existing source that other sources/collections are referencing #661

Closed
paynejd opened this issue Mar 23, 2021 · 13 comments
Assignees
Labels
api2 OCL API v2 discussion-needed Flagged for discussion on OCL Community call

Comments

@paynejd
Copy link
Member

paynejd commented Mar 23, 2021

Specifically, we are getting ready for when we will delete the PIH source on staging

Will also need to implement proper handling of mappings/references after deletes
How do we handle deletes of content that others have mapped/referenced? What happens if an updated source is uploaded after it was deleted?
From_concept = /orgs/CIEL/sources/CIEL/v2021-03-23/concepts/123/
From_concept = /orgs/CIEL/sources/CIEL/concepts/123/139493/

@snyaggarwal snyaggarwal added api2 OCL API v2 discussion-needed Flagged for discussion on OCL Community call labels May 6, 2021
@paynejd paynejd changed the title Proper handling of mappings/references after deletes Need ability to delete an existing source that other sources/collections are referencing Aug 20, 2021
@bmamlin
Copy link

bmamlin commented Oct 21, 2021

@paynejd this is becoming painful for PIH testing (using PIH-temp dictionary isn't ideal) and will become a blocker soon for PIH. I suppose a workaround could be for @snyaggarwal to manually delete the PIH dictionary with each needed update.

@snyaggarwal
Copy link
Contributor

@paynejd @bmamlin current behaviours:

  1. On a concept hard delete, its collection references and mappings will stay as is, that means the mappings and references will show the unresolved reference to the deleted concept.
  2. Same for source hard delete, its collection references and mappings will stay as-is.

The only rule right now is you cant delete a source/version which has its concepts/mappings referred to in a private collection (public_access=None).

@bmamlin
Copy link

bmamlin commented Nov 11, 2021

The only rule right now is you cant delete a source/version which has its concepts/mappings referred to in a private collection (public_access=None).

Can this be fixed? There are (not unexpectedly) references to PIH from private collections (anyone working on a personal collection with CIEL content could have mappings to PIH), so I still cannot hard delete the PIH source.

@snyaggarwal
Copy link
Contributor

The only rule right now is you cant delete a source/version which has its concepts/mappings referred to in a private collection (public_access=None).

Can this be fixed? There are (not unexpectedly) references to PIH from private collections (anyone working on a personal collection with CIEL content could have mappings to PIH), so I still cannot hard delete the PIH source.

@paynejd This feature was added recently because of #103. Now I think we have references and mappings that may exist even if their referred content doesn't. So is it ok if we revert this?

@paynejd
Copy link
Member Author

paynejd commented Nov 11, 2021 via email

@snyaggarwal
Copy link
Contributor

I meant should we revert #103 ?

@paynejd
Copy link
Member Author

paynejd commented Nov 12, 2021

For now, we agreed to revert #103, which means that we will be able to delete a source that has content that is mapped/referenced by other resources, regardless of whether it is public or private. This will make it so that the behavior for public/private resource links are consistent.

However, a concept/mapping that is referenced in a collection will be removed from existing collection versions, even though the reference will still remain. As part of the upcoming dynamic reference/expansion work, we are planning to save certain attributes from concepts/mappings that have been evaluated in an expansion, so that we'll retain the info that a concept/mapping was part of the expansion, but the user will no longer be able to follow that concept/mapping reference to lookup all of the remaining details.

Need a new ticket for this.

snyaggarwal added a commit to OpenConceptLab/oclapi2 that referenced this issue Nov 12, 2021
@bmamlin
Copy link

bmamlin commented Nov 22, 2021

Hey @snyaggarwal ... any ETA when this might be available on staging?

@snyaggarwal
Copy link
Contributor

@bmamlin Its available on all environments

@bmamlin
Copy link

bmamlin commented Nov 23, 2021

@bmamlin Its available on all environments

Thanks @snyaggarwal. When I'm logged in as ocladmin on staging looking at /orgs/PIH/sources/PIH/, click the trash can, and type "PIH" to confirm deletion, the browser makes the request DELETE https://api.staging.openconceptlab.org/orgs/PIH/sources/PIH/. This runs for a minute and then returns a 502 error with this brief toast appearing in the UI:

This is the same behavior I've been seeing. Is it supposed to work through the UI? It looks like it's making the same RESTful DELETE call that I'd be making manually anyway.

@snyaggarwal
Copy link
Contributor

@bmamlin the UI is trying to do synchronous delete which is causing timeout due to the size of source. This needs to be fixed.
Meanwhile, you can try async delete by adding ?async=true to the DELETE request and it should queue it for async delete.

@snyaggarwal
Copy link
Contributor

Created ticket for this #1128

@snyaggarwal
Copy link
Contributor

closing this as #1128 is more latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api2 OCL API v2 discussion-needed Flagged for discussion on OCL Community call
Projects
None yet
Development

No branches or pull requests

3 participants