Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Merge Two Collection Protocols

Introduction

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 on the basis of the PPID or the participant ID.

Merge happens in following way.

Source CP - The protocol which is to be closed.

Target CP - The protocol in which source CP's registrations are to be merged.

Pre-requisites

  1. Only super admin can merge two collection protocols.
  2. Both CPs must have same label formats for PPI, visit and specimens or target CP not having any specific formats specified.

Merge Logic

  1. Move all participant registrations to target CP.
  2. Match found - Move all visits and specimens of source registration to target registration
    1. If participant with same PPID is found in target CP
    2. If the participant is registered on both source and target CP
  3. Match not found: If participant with same PPID or participant ID is not found, then register the source CP participant to target CP.
  4. Matching of participants is done on basis of PPID and participant ID.
  5. Map all visits of source CP registration to first event of target CP and mark all created specimens as unplanned.
  6. Forms data handling
    1. Participant Level Forms :

      1. For matching registrations, the system will not merge forms of source registration to target. So in this case forms will deleted along with source registration.

      2. For non matching participants, forms will be merged along with source registration. Here forms will merge even if that form does not exist at participant level for source cp.

    2. 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 have not handled/checked container restriction while merging. i.e if specimens are stored in container only for source CP even then registrations will be merged 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.

API URL - http://<host>:<port>/openspecimen/rest/ng/collection-protocols/merge

Below are the attributes which need to be sent in the request body:

Parameter
Details
srcCpShortTitleShort title of collection protocol which wanted to merge.
tgtCpShortTitleShort title of collection protocol in which source protocol going to merge

Example:

URLhttp://<host>:<port>/openspecimen/rest/ng/collection-protocols/merge
MethodPOST
Requestapplication/json
json
{
"srcCpShortTitle""Brain Cancer v2",
"tgtCpShortTitle""Brain Cancer"
}

Response

{
"srcCpShortTitle""Brain Cancer v2",
"tgtCpShortTitle""Brain Cancer"
}
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com