openspecimen/rest/ng/collection-protocols/merge
Sometimes users wants to close one collection protocol and merge all registrations/data of that protocol with another protocol. In this case this API is useful to merge two collection protocols.
Merge happens in following way.
Lets say
Source CP - The protocol which wanted to close.
Target CP - The protocol in which source CP's registrations wanted to merge.
Pre-conditions :
1.Only super admin can merge two collection protocols.
2. PPID, visit, specimen, derivative, aliquot formats of target CP is same as respective formats of source CP or should be blank.
Merge Logic :
- Move all participant registrations to target CP.
- If participant match found in target CP, then move all visits and specimens of source registration to target registration. If no matched participant found then make source registration to target CP.
- Matching of participants is done on basic of PPID and participant ID.
- Map all visits of source CP registration to first event of target CP and mark all created specimens as unplanned.
- Forms data handling
Participant Level Forms :
1. For matching registrations, it will not merge forms of source registration to target. So in this case forms will deleted along with source registration.2.For not matching participants, forms will merged along with source registration. Here forms will merge even if that form is not exist at pa*strong text*rticipant level for source cp.
Visit and Specimen Level Forms:
All visit and specimen level forms will merge along with visit and specimens.Here same as participant those forms are not a part of target CP those also get merged.Note: We are not handled/checked container restriction while merging. i.e Even if specimens are stored in container only for source CP then also can merge registrations with target CP. We need to handle this manually like change restrictions of container.
Use HTTP POST method to call this API by passing the below details in JSON format.
Below are the attributes which need to be sent in the request body:
Parameter | Details |
---|---|
srcCpShortTitle | Short title of collection protocol which wanted to merge. |
tgtCpShortTitle | Short title of collection protocol in which source protocol going to merge |
Example:
URL | http://<host>:<port>/ openspecimen/rest/ng/collection-protocols/merge | |
Method | POST | |
Request | application/json | |
json |
| |
Response | { "srcCpShortTitle" : "Brain Cancer v2" "tgtCpShortTitle" : "Brain Cancer" }
|