...
Add custom fields on the specimen table
Note |
---|
The specimen custom field is only supported on specimen manifest. The order and request manifest doesn't support it |
Expand |
---|
title | Steps to configure the manifest template |
---|
|
Download the default manifest template file of your choice (for example visit.html) from the system setting as shown above. Open the template in the editor of choice. Go to the specimen table, add additional custom fields of your choice (for example “Use Specimen for Research”) as shown below in the script, and save it. Follow the above steps to import the manifest template either at the system or individual level and download the manifest PDF for the same.
Script to add custom field on the specimen table Code Block |
---|
....
....
<h3> Specimens </h3>
<table class="specimens">
<thead>
<tr>
<th>Label</th>
<th>Parent</th>
<th>Type</th>
<th>Use Spcimen for Research</th>
<th>Quantity</th>
<th>Processing Date</th>
<th>Location</th>
</tr>
</thead>
<tbody>
#foreach ($spmn in $allSpecimens)
<tr>
<td>
#if ($spmn.label)
<span>$spmn.label</span>
#end
</td>
<td>
#if ($spmn.parentLabel)
<span>$spmn.parentLabel</span>
#end
</td>
<td>$spmn.type</td>
<td>
#if ($spmn.extensionDetail.attrsMap.use_specimen_for_research)
<span>$spmn.extensionDetail.attrsMap.use_specimen_for_research</span>
#end
</td>
<td>
#if ($spmn.status == 'Collected')
#if ($spmn.availableQty)
<span>$spmn.availableQty</span>
<span>$spmn.getQuantityUnit()</span>
#end
#elseif ($spmn.status == 'Pending' || !$spmn.status)
#if ($spmn.initialQty)
<span>$spmn.initialQty</span>
<span>$spmn.getQuantityUnit()</span>
#end
#end
</td>
<td>
#if ($spmn.lineage == 'New' and $spmn.collectionEvent.time)
<span>$dateFmt.format($spmn.collectionEvent.time)</span>
#elseif ($spmn.createdOn)
<span>$dateFmt.format($spmn.createdOn)</span>
#end
</td>
<td>
#if ($spmn.storageLocation.name)
<span>$spmn.storageLocation.name</span>
#if ($spmn.storageLocation.mode == 'TWO_D')
<span>($spmn.storageLocation.positionY, $spmn.storageLocation.positionX)</span>
#elseif ($spmn.storageLocation.mode == 'LINEAR')
<span>($spmn.storageLocation.position)</span>
#end
#end
</td>
</tr>
#end
</tbody>
</table>
....
.... |
Manifest PDF View View file |
---|
name | visit_with_custom_field.html |
---|
|
View file |
---|
name | specimens-manifest_with_custom_field.pdf |
---|
|
|
...
No. Order manifest doesn’t support specimen custom or participant registration fields such as (External Suj ID).
We suggest using the order report option where the user attaches a custom query with required fields to your Distribution protocol and generates a report for orders under it. https://openspecimen.atlassian.net/wiki/spaces/CAT/pages/1492680746/Additional+Distribution+Features#Report
3. Would it be possible to page break or start a new page?
...
<div style="page-break-after:always"></div>
Example:
Expand |
---|
title | Example Complete Code |
---|
|
Code Block |
---|
#foreach ($spmn in $allSpecimens)
<div style="page-break-after: always;"></div>
#if ($visit.extensionDetail.attrsMap.service_request && $spmn.lineage == 'New' && $spmn.collectionEvent.time && ($spmn.label.startsWith("P1") || $spmn.label.startsWith("P6")))
<tr>
<td class="label">First Name</td>
<td>: <![CDATA[$cpr.participant.firstName]]></td>
</tr>
<tr>
<td class="label">Last Name</td>
<td>: <![CDATA[$cpr.participant.lastName]]></td>
</tr>
<tr>
<td class="label">MRN</td>
<td>: <![CDATA[$cpr.participant.empi]]></td>
</tr>
<tr>
<td class="label">Date of Birth</td>
<td>: $dateOnlyFmt.format($cpr.participant.birthDate)</td>
</tr>
<tr>
<td class="label">Participant ID</td>
<td>: <![CDATA[$cpr.ppid]]></td>
</tr>
<tr>
<td class="label">PI Name</td>
<td>: <![CDATA[$cp.principalInvestigator.firstName $cp.principalInvestigator.lastName]]></td>
</tr>
<tr>
<td class="label">PI Email</td>
<td>: <![CDATA[$cp.principalInvestigator.emailAddress]]></td>
</tr>
#foreach ($request in $visit.extensionDetail.attrsMap.service_request)
#if (($spmn.label.startsWith("P1") && $request.service_requested == 'DNA Extraction') || ($spmn.label.startsWith("P6") && $request.service_requested == 'PBMC Processing'))
<tr>
<td class="label">Service Requested</td>
<td>: <![CDATA[$request.service_requested]]></td>
</tr>
<tr>
<td class="label">Number of tubes</td>
<td>: <![CDATA[$request.number_of_tubes]]></td>
</tr>
<tr>
<td class="label">Volume in each tube</td>
<td>: <![CDATA[$request.volume_in_each_tube2]]></td>
</tr>
<tr>
<td class="label">Collection Date</td>
<tr>: <![CDATA[$dateFmt.format($spmn.collectionEvent.time)]]></tr>
</tr>
#if ($request.comments)
<tr>
<td class="label">Comments</td>
<td>: <![CDATA[$request.comments]]></td>
</tr>
#end
#end
#end
<tr>
<td>----------------------------------------------------------------------------------</td>
<td>-----------------------------------------</td>
</tr>
#end
#end |
|
...
4. Is it possible to sort the specimen table in order manifest based on the ascending order of PPID?
Ans: Yes. You need to implement the sorting function directly within the HTML template as shown below (before the start of <html> tag).
Syntax
Code Block |
---|
#set($numItems = $items.size())
#set($range = $numItems - 1)
#foreach ($i in [0..$range])
#set($subRange = $range - $i - 1)
#if ($subRange >= 0)
#foreach ($j in [0..$subRange])
#if ($items.get($j).specimen.ppid.compareTo($items.get($j + 1).specimen.ppid) > 0)
#set ($temp = $items[$j])
#set ($items[$j] = $items[$j + 1])
#set ($items[$j + 1] = $temp)
#end
#end
#end
#end |
Example:
5. Is it possible to sort the specimen table in order manifest based on the descending order of PPID?
Ans: Yes. You need to implement the sorting function directly within the HTML template as shown below (before the start of <html> tag).
Syntax
Code Block |
---|
#set($numItems = $items.size())
#set($range = $numItems - 1)
#foreach ($i in [0..$range])
#set($subRange = $range - $i - 1)
#if ($subRange >= 0)
#foreach ($j in [0..$subRange])
#if ($items.get($j).specimen.ppid.compareTo($items.get($j + 1).specimen.ppid) < 0)
#set ($temp = $items[$j])
#set ($items[$j] = $items[$j + 1])
#set ($items[$j + 1] = $temp)
#end
#end
#end
#end |