Leave a comment at the end of this page or email contact@krishagni.com
Attribute Types Examples
In case of custom fields
Please note: For versions 8.0 and above, you need to use 'variableName' and for those prior to v8.0, the field names would be DD1, ST2, RB3 etc.
You will observe that 'variableName' is used in all examples. These are field names based upon control types present in the form attached at the custom fields' level.
Steps to add the custom fields to the JSON:
Go to the Forms tab → Click on the form → Click on Export → zipped file is downloaded.
Extract the zipped file and open the XML file.
For each field in XML, you can observe these names are enclosed within '<name> </name>' tag. For example: <name>variableName</name>
Use these names to define the fields in JSON.
Ensure that the form is attached to the CP at the particular custom field level.
Below is a list of different attribute types that can be used during the SDE or RDE setup.
Level | Attribute Type | Description | Example JSON | |
---|---|---|---|---|
1 | Participant | Text Custom Field | The custom text field is to be displayed on the participant add, edit and overview pages.
You need to specify the 'pattern' to if you want to restrict the text input on to follow certain condition. If links or URL are added to the text fields, they will be hyperlinked and clickable on the overview pages. | {
"name": "cpr.participant.extensionDetail.attrsMap.variableName",
"caption": "Country",
"type": "text",
"optional": true
}
Example pattern to allow only capital letters. "pattern" : "/^[A-Z]+$/" |
2 | Participant | Date Custom Field | 'DOB of Mother' is a field that stores date hence marked as 'date' in the property type. | {
"name": "cpr.participant.extensionDetail.attrsMap.variableName",
"caption": "DOB of Mother",
"type": "date",
"dateOnly": true,
"optional": true
} |
3 | Participant | Note Custom Field (v9.0) | Adds a note field. You can add multiple note fields within JSON as: "name": "cpr.note1", "name": "cpr.note2", and so on. For visit: "name": "visit.note5" For specimen: "name": "specimen.note6"
|
|
4 | Participant | Number Custom Field with pattern | When you want to validate the pattern during data-entry, use 'type': “text”. Use case: The first digit of the age field should always be between 1 and 9.
| |
5 | Participant | Number Custom Field (v11) | When you don’t want to validate the pattern during data-entry, we use 'type': “number” (supported in v11). | |
6 | Participant | Number Custom Field (With decimal values) | You need to specify the 'pattern' to allow decimal values. | Simple example: a) Max. 2 digits before decimal point. Max. 10 digits after decimal point b) Any number of digits before decimal point. Exact 2 digits after decimal point, if any c) Same as b) but allow negative fractions as well Explanation: a) ^ (caret) - Indicates start of string/input b) $ - end of the string/input c) ? - any character, group or pattern before this is optional d) \d - any digit 0-9 e) + - one or more occurrences of the preceding character, group, or pattern f) {m, n} - specifies the preceding character, group, or pattern should match at least m times and at max n times. Detailed explanation: ^-?: minus sign should appear at the start of the string/input. The minus sign is optional. ^-?\d+: An optional minus sign can appear at the start of the string/input. Followed by that, at least one digit (0, 9) should occur in the input string. ^-?\d+(\.\d{2,5})?$: An optional minus sign can appear at the start of the input string. Followed by that, at least one digit. An optional dot and at least 2 digits, at max 5 digits after the dot can appear. After this, no more characters can appear in the string. |
7 | Participant | DropDown Custom Field | A dropdown field from the custom form 'JSONTParticipantExtention' named 'Select Any Option' is fetched here. | |
8 | Participant | Text area Custom Field | The custom text area field is to be displayed on the participant overview page/create participant page. | |
9 | Participant | Radio Button Custom Field | The field 'Is participant Allergic?' is mapped to a field, and the options are 'Yes'/'No'. Note At present, the radio button works with only inline options. | |
10 | Participant | Dropdown Multiselect Custom Field | Multiple select dropdown fields from the custom form 'JSONTParticipantExtention' named Diagnosis Subtype' are fetched here. | |
11 | Specimen | Text | The field specimen label will be displayed only if the specimen label format is not specified or manual input for the specimen label field is allowed. This is the 'showif' condition added in the example JSON. | |
12 | Specimen | Text | Additional Label | |
13 | Specimen | Number | When adding a numeric field user can specify the 'pattern', which will allow only specific numbers. | |
14 | Participant | Dropdown (OS standard field) | To retrieve the standard values from the OpenSpecimen dropdown, you must specify the type as 'pvs'. | |
15 | Specimen | Dropdown (custom field) | A dropdown field from the custom form 'SpecimenAdditionalFields' named 'Method |