Leave a comment at the end of this page or email contact@krishagni.com
JSON: Custom Fields (Participant, Visit and Specimens)
Introduction
You can use the configuration settings below to display custom fields at any level (participant, visit, or specimen) for data entry or read-only access, based on your requirements.
Field Configuration
To enable data entry for custom fields, developers can use the edit field configuration.
<entity> refers to the record type (Participant, Visit, or Specimen). A user should define the correct record type based on the requirement. Below are the syntax that should be used:
Participants = cpr.participant
Visits = visit
Specimens = specimen
‘<formVariableName>' refers to the custom form’s variable name. It is present between <name> tags in your form’s XML file in the 3rd line.
'<variableName>' refers to the custom field’s variable name. It is present between <name> tags in your form’s XML file within a field tag.
'<Field Name>' refers to the Label/Caption, the user wants to add for the Custom Field.
Check https://openspecimen.atlassian.net/wiki/spaces/CAT/pages/1763639612/Form+Actions#Export page to learn how to download the XML file.
Field Type | Common Syntax | Example Code |
|---|---|---|
Text | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "text"
} | {
"name": "cpr.participant.extensionDetail.attrsMap.country",
"caption": "Country",
"type": "text"
} |
Text Area | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "textarea"
} | {
"name": "specimen.extensionDetail.attrsMap.additional_details",
"caption": "Specimen Additional Details",
"type": "textarea"
} |
Number | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "number"
} | {
"name": "cpr.participant.extensionDetail.attrsMap.age",
"caption": "Participant's Age",
"type": "number"
} |
PV | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "pvs",
"attr": "<Unique Attribute ID>",
"optional": "true"
} | {
"name": "specimen.extensionDetail.attrsMap.chemical_additive",
"caption": "chemical Additive",
"type": "pvs",
"attr": "chemical_additives",
"optional": "true"
}
|
Single-select Dropdown | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "dropdown",
"listSource" : {
"apiUrl" : "forms/permissible-values",
"selectProp" : "value",
"displayProp" : "value",
"queryParams" : {
"dynamic" : { },
"static" : {
"formName" : "<formVariableName>",
"controlName" : "<variableName>"
}
}
}
} | {
"name": "specimen.extensionDetail.attrsMap.storage_tube",
"caption": "Storage Tube Type",
"type": "dropdown",
"listSource" : {
"apiUrl" : "forms/permissible-values",
"selectProp" : "value",
"displayProp" : "value",
"queryParams" : {
"dynamic" : { },
"static" : {
"formName" : "iugb_specimen_custom_field",
"controlName" : "storage_tube"
}
}
}
} |
Site Dropdown | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "dropdown",
"listSource": {
"apiUrl": "sites",
"displayProp": "name",
"selectProp": "name",
"queryParams": {
"dynamic": {},
"static": {
"listAll": true
},
"search": "name"
}
}
} | {
"name": "visit.extensionDetail.attrsMap.institutes",
"caption": "Institutes",
"type": "dropdown",
"listSource": {
"apiUrl": "sites",
"displayProp": "name",
"selectProp": "name",
"queryParams": {
"dynamic": {},
"static": {
"listAll": true
},
"search": "name"
}
}
} |
Multi-select Dropdown | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "dropdown",
"multiple": true,
"listSource": {
"apiUrl" : "forms/permissible-values",
"searchProp": "searchString",
"displayProp": "value",
"selectProp": "value",
"queryParams": {
"static": {
"formName" : "<formVariableName>",
"controlName" : "<variableName>"
}
}
}
} | {
"name": "visit.extensionDetail.attrsMap.sops",
"caption": "SOP Adopted",
"type": "dropdown",
"multiple": true,
"listSource": {
"apiUrl" : "forms/permissible-values",
"searchProp": "searchString",
"displayProp": "value",
"selectProp": "value",
"queryParams": {
"static": {
"formName" : "csti_visit_custom_fields",
"controlName" : "sops"
}
}
}
} |
Checkbox | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "checkbox",
"options": [
{
"caption": "<Label for First Value>",
"value": "<First value>"
},
{
"caption": "<Label for Second Value>",
"value": "<Second Value>"
}
],
"optionsPerRow": 2
} | {
"name": "visit.extensionDetail.attrsMap.DM_liecba",
"caption": "Liečba",
"type": "checkbox",
"options": [
{
"caption": "len diéta",
"value": "len diéta"
}
{
"caption": "PAD",
"value": "PAD"
},
{
"caption": "inzulín",
"value": "inzulín"
}
],
"optionsPerRow": 2
} |
Radio | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "radio",
"optional": true,
"options": ["Yes","No"]
} | {
"name": "cpr.participant.extensionDetail.attrsMap.allergic",
"caption": "Is participant Allergic?",
"type": "radio",
"optional": true,
"options": ["Yes","No"],
"defaultValue": "Yes"
} |
File | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "fileUpload",
"url": "/rest/ng/form-files"
}Please note: The URL varies based on the client. URL syntax: Example for Arizona: ARIZONA Test URL:
| {
"name": "cpr.participant.extensionDetail.attrsMap.pdf_documents",
"caption": "PDF Documents",
"type": "fileUpload",
"url": "/rest/ng/form-files"
} |
Signature | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "signature",
"uploader": (data) => window.osSvc.http.post('form-files/images', {dataUrl: data}).then(({fileId}) => fileId),
"imageUrl": (fileId) => window.osSvc.http.getUrl('form-files/' + fileId)
} | {
"name": "cpr.participant.extensionDetail.attrsMap.guardians_signature",
"caption": "Guardian's Signature",
"type": "signature",
"uploader": (data) => window.osSvc.http.post('form-files/images', {dataUrl: data}).then(({fileId}) => fileId),
"imageUrl": (fileId) => window.osSvc.http.getUrl('form-files/' + fileId)
} |
User | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "user",
"enableCopyFirstToAll": true
} | {
"name": "visit.extensionDetail.attrsMap.lab_user",
"caption": "Lab User",
"type": "user",
"enableCopyFirstToAll": true
} |
Date Only | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "date",
"optional": true
} | {
"name": "cpr.participant.extensionDetail.attrsMap.dobmother",
"caption": "DOB of Mother",
"type": "date",
"optional": true
} |
DateTime | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type": "datetime"
} | {
"name": "specimen.extensionDetail.attrsMap.ischemia_start_time",
"caption": "Ischemia Start Time",
"type": "datetime"
} |
Yes/No Checkbox | {
"name": "<entity>.extensionDetail.attrsMap.<variableName>",
"caption": "<Field Name>",
"type" : "toggle-checkbox",
"values" : {
"trueValue" : true,
"falseValue" : false
},
"displayExpr" : "specimen.extensionDetail.attrsMap.variableName == '1' ? 'Yes' : 'No' "
} | {
"name" : "specimen.extensionDetail.attrsMap.missed_collection",
"caption" : "Missed Collection",
"type" : "toggle-checkbox",
"values" : {
"trueValue" : true,
"falseValue" : false
},
"displayExpr" : "specimen.extensionDetail.attrsMap.variableName == '1' ? 'Yes' : 'No' "
} |
SubForm | {
"name": "<entity>.extensionDetail.attrsMap.<SubForm_variableName>",
"caption": "<Field Name>"
"type" : "collection",
"fields": [
{
"name": "<SubFormField_variableName>",
"caption": "<Field Name>",
"type" : "pvs",
"attr" : "<Unique Attribute ID>",
"optional" : true
}
]
} | {
"name" : "specimen.extensionDetail.attrsMap.histological_details",
"caption": "Histological Details",
"type" : "collection",
"fields" : [ {
"name" : "histological_qualityy",
"caption" : "Histological quality",
"type" : "pvs",
"attr" : "histological_quality",
"optional" : true
} ]
} |
Leave a comment at the end of this page or email contact@krishagni.com