Add API endpoint for merging person clusters#203
Conversation
…thub.com/CDCgov/RecordLinker into feature/161-API-endpoint-for-merging-person-clusters
…ature/161-API-endpoint-for-merging-person-clusters
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #203 +/- ##
==========================================
- Coverage 97.70% 97.68% -0.02%
==========================================
Files 32 32
Lines 1610 1645 +35
==========================================
+ Hits 1573 1607 +34
- Misses 37 38 +1 ☔ View full report in Codecov by Sentry. |
|
@m-goggins re question 1; this is accounted for in use case 12 of the MPI API design. My original thought was, let's make this an explicit DELETE rather than an implicit one. It's true that these old person clusters are orphaned and no longer in use, however we can not definitely say that the user's systems have purged all references to these clusters. By making it an explicit step to DELETE the orphaned person clusters, we have more trust that the user is doing the same with their references. This isn't a hard requirement, nor am I married to that implementation. It may turn out that automatic cleanup is easier, or we could just provide a flag in the payload to indicate that automatic removal is preferred. |
…ature/161-API-endpoint-for-merging-person-clusters
bamader
left a comment
There was a problem hiding this comment.
Mostly looks solid to me, just some nits on language and comment cleanups that I think could help reduce the cognitive burden of reading some of this stuff
Co-authored-by: Eric Buckley <eric.buckley@gmail.com>
@m-goggins PR is looking great, thanks for all your work on this so far. I wanted to revisit the above with regard to auto removal of the person cluster when its empty. What do you think about updating the payload to accept a flag for this action? Do you think that would be helpful for users? |
…ature/161-API-endpoint-for-merging-person-clusters
@ericbuckley That sounds like a good approach to me. I can make that change. |
bamader
left a comment
There was a problem hiding this comment.
Approving so I don't block, since we've got agreement on new comments.
Co-authored-by: Eric Buckley <eric.buckley@gmail.com>
ericbuckley
left a comment
There was a problem hiding this comment.
This looks great @m-goggins thanks for all your work on this!
Description
This PR adds a new endpoint to merge person clusters as such
POST /person/<person-reference-id>/merge -d '{"persons": ["<person-reference-id1>", "<person-reference-id2>"]}'.Two questions that I want to raise about the PR:
After the person clusters are merged, e.g.,
person-reference-id1andperson-reference-id2intoperson-reference-idas above,person-reference-id1andperson-reference-id2are not currently cleaned up (deleted from the database). Originally I wasn't sure if this should occur as a separate step, but after working on the endpoint and our discussion about additional manual work yesterday, I think I should add a cleanup step after merging to removeperson-reference-id1andperson-reference-id2. In theory, this cleanup could occur on the routine cleanup that we've talked about but not yet implemented, but I like the "cleanup as you go if you can" approach for now. Thoughts?Does anyone have strong opinions on creating similar functions that have different inputs and returns like
get_person_by_reference_idandget_persons_by_reference_ids? They are used for slightly different purposes but I could condense into a single function if folks feel it improves clarity.Related Issues
Fixes #161