Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page explains how to delink forms attachment from ‘All current and future collection protocols’ and link to specific protocols or collection protocol group(CPG). If data is already entered, and if form attachment is changed via UI, data is lost. Follow the below steps to do it without losing data.

...

You can see the three entries of IDENTIFIER and CP_ID, which means the CPG contains these three CPs to which the form is attached.

...

Expand
titleselect SQL for count of record across the CP

Code Block
select re.identifier from catissue_form_record_entry re 
inner join catissue_form_context fc on fc.identifier = re.form_ctxt_id
inner join catissue_specimen_coll_group cpg on cpg.identifier =re.object_id 
inner join catissue_coll_prot_reg cpr on cpr.identifier = cpg.Collection_protocol_reg_id 
where fc.identifier = <Old Context ID> and cpr.collection_protocol_id = <CP ID>;

If the form is attached at the specimen form level, you need use below SQL.

Expand
titleselect SQL for count of record across the CP

Code Block
select re.identifier from catissue_form_record_entry re 
inner join catissue_form_context fc on fc.identifier = re.form_ctxt_id 
inner join catissue_specimen cs on cs.identifier = re.object_id 
 where fc.identifier = <Old Context ID> and cs.collection_protocol_id = <CP ID>;

...

You will get the new context id, CP id from #4 step, and old context id from #1 steps. You can check the rows affected after running the SQL and cross verify the count from #5 step.

...

Go back to the UI, ; You can see the form is attached to only specific CPs which are part of CPG.

...

For more details about the DB, table refer to http://dbschema.openspecimen.org/.