In a config modifier schema, use if to define a conditional state to run a given action or not.
If properties, if, concat, switch, pipe, or merge are present at the same nesting level, only the first keyword listed will run. We recommend not listing these keywords together at the same nesting level.
A conditional allows you to determine how to construct an output value by conditionally executing different keywords, based on the evaluation of a set of values.
You can use one of these sub-keywords to construct a conditional statement:
- operator
- terms
- then
- else
This keyword executes at the following nesting level:
- omit
- constant
- references
- use
- get
- properties or if or concat or switch or pipe or merge
- default
- plugin
Determines what action to take based on one of the following operators. The config modifier defines what should happen if a value exists and meets the criteria of any of these operators.
We define existence of a value based on some rules. Specifically, these evaluations are defined as does not exist:
- undefined
- null
- ''
- []
- NaN
We specifically treat some Falsy (learn about Falsy) values as exists:
- false
- 0
- ' ' (empty string but padded with a space)
Specifies that all defined terms should be equal to each other.
If the terms match, the then action occurs. If the values don't match, the else action occurs.
1"identifier": [2{3"system": "urn:redox:1a359110-47eb-40f6-924c-1e67079574a4:wshmrn",4"type": {5"text": "WSHMRN"6},7"value": "050050184"8},9...10]
1$.entry[?(@.resource.resourceType=="Patient")].resource.identifier[*].type.text
1if:2operator: equals3terms:4- {}5- constant: WHSMRN6then:7constant: MR8else:9comment: no match, pass through
Based on this example config modifier, the output would be:
1"identifier": [2{3"system": "urn:redox:1a359110-47eb-40f6-924c-1e67079574a4:wshmrn",4"type": {5"text": "MR"6},7"value": "050050184"8},9...10}11]
Specifies that all defined terms exist.
If all terms are present, the then action occurs. If all terms aren’t present, the else action occurs.
1"identifier": [2{3"system": "urn:redox:1a359110-47eb-40f6-924c-1e67079574a4:wshmrn",4"type": {5"text": "WSHMRN"6},7"value": "050050184"8},9...10],
1$.entry[?(@.resource.resourceType=="Patient")].resource.identifier[*]
1if:2operator: all3terms:4- get: type.text5then:6if:7operator: equals8terms:9- get: type.text10- constant: WSHMRN11then:12merge:13- {}14- properties:15type:16properties:17text:18constant: MR19system:20get: system21plugin:22name: text23action: replace24parameters:25newValue: mr26searchValue: wshmrn27else:28comment: do nothing29else:30comment: type.text does not exist, do nothing
Based on this example config modifier, the output would be:
1"identifier": [2{3"system": "urn:redox:1a359110-47eb-40f6-924c-1e67079574a4:mr",4"type": {5"text": "MR"6},7"value": "050050184"8},9...10],
Specifies that at least one of the defined terms exists.
If at least one of the terms is present, the then action occurs. If none aren’t present, the else action occurs.
Let’s say you have a list of patient contacts that are missing phone number information, which you need for your workflow. You decide to remove contacts that don’t have at least one phone number listed.
1{2"Patient": {3...4"Contacts": [5{6"Address": {7"City": "Speedy",8"Country": null,9"County": null,10"State": "CA",11"StreetAddress": "5559 E. Washington St",12"ZIP": "12345"13},14"EmailAddresses": [15],16"FirstName": "Elizabieth",17"LastName": "Santa",18"MiddleName": null,19"PhoneNumber": {20"Home": "+10000000000",21"Mobile": "+10000000000",22"Office": null23},24"RelationToPatient": "Other",25"Roles": [26"PC"27]28},29{30"Address": {31"City": "Speedy",32"Country": null,33"County": null,34"State": "CA",35"StreetAddress": "5559 E. Washington St",36"ZIP": "12345"37},38"EmailAddresses": [39],40"FirstName": "Joshua",41"LastName": "Santa",42"MiddleName": null,43"PhoneNumber": {44"Home": "+15551231234",45"Mobile": "+15551231234",46"Office": null47},48"RelationToPatient": "Spouse",49"Roles": [50"SC"51]52},53{54"Address": {55"City": null,56"Country": null,57"County": null,58"State": null,59"StreetAddress": null,60"ZIP": null61},62"EmailAddresses": [63],64"FirstName": null,65"LastName": "Disabled",66"MiddleName": null,67"PhoneNumber": {68"Home": null,69"Mobile": null,70"Office": null71},72"RelationToPatient": null,73"Roles": [74"EMP"75]76}77]78}79}
To implement this, you need to rebuild the Patient.Contacts array by checking that there’s at least one phone number listed under PhoneNumber for each contact.
1$.Patient.Contacts
If there at least one phone number is present, you want to keep the contact, otherwise it should be removed. This is an ideal scenario to use the operator of some that evaluates a set of terms (phone numbers in this case) where at least one of the values must evaluate to true.
1items:2if:3operator: some4terms:5- get: PhoneNumber.Home6- get: PhoneNumber.Mobile7- get: PhoneNumber.Office8then: {}9else:10omit: true
Based on this example config modifier, the output would be:
1{2"Patient": {3...4"Contacts": [5{6"Address": {7"City": "Speedy",8"Country": null,9"County": null,10"State": "CA",11"StreetAddress": "5559 E. Washington St",12"ZIP": "12345"13},14"EmailAddresses": [15],16"FirstName": "Katie",17"LastName": "Santa",18"MiddleName": null,19"PhoneNumber": {20"Home": "+10000000000",21"Mobile": "+10000000000",22"Office": null23},24"RelationToPatient": "Other",25"Roles": [26"PC"27]28},29{30"Address": {31"City": "Speedy",32"Country": null,33"County": null,34"State": "CA",35"StreetAddress": "5559 E. Washington St",36"ZIP": "12345"37},38"EmailAddresses": [39],40"FirstName": "John",41"LastName": "Santa",42"MiddleName": null,43"PhoneNumber": {44"Home": "+15551231234",45"Mobile": "+155531231234",46"Office": null47},48"RelationToPatient": "Spouse",49"Roles": [50"SC"51]52}53]54}55}
Specifies that none of the defined terms exist.
If none of the terms are present, the then action occurs. If at least one of the terms is present, the else action occurs.
1{2"Meta": {3"DataModel": "Results",4"EventDateTime": "2025-06-10T18:20:25.266744",5...6},7"Orders": [8{9...10"Results": [11{12"AbnormalFlag": null,13"Code": "PTEDEVENT",14"Codeset": "PTEDLRR",15"CompletionDateTime": null,16...17}18],19"ResultsStatus": "In Process",20"Status": "In Process",21"TransactionDateTime": null22}23],24...25})
1if:2operator: none3terms:4- {}5then:6use: initialPayload7get: Meta.EventDateTime8else: comment: do nothing
Based on this example config modifier, the output would be:
1{2"Meta": {3"DataModel": "Results",4"EventDateTime": "2025-06-10T18:20:25.266744",5...6},7"Orders": [8{9...10"Results": [11{12"AbnormalFlag": null,13"Code": "PTEDEVENT",14"Codeset": "PTEDLRR",15"CompletionDateTime": "2025-06-10T18:20:25.266744",16...17}18],19"ResultsStatus": "In Process",20"Status": "In Process",21"TransactionDateTime": null22}23],24...25})
Specifies that the first value in the defined terms contains the second value.
If the second value is included in the first, the then action occurs. If not—or if the first value isn’t an array or a single string—the else action occurs.
If a string, value matching is case-sensitive. The second value must be a single primitive value.
1"Observations": [2{3"AbnormalFlag": null,4"Code": "93246-7",5...6"Status": "Final",7"Units": null,8"Value": "1",9"ValueType": "Coded Entry"10},11{12"AbnormalFlag": null,13"Code": "93247-5",14...15"Status": "Final",16"Units": null,17"Value": "1",18"ValueType": "Coded Entry"19},20{21"AbnormalFlag": null,22"Code": "93267-3",23...24"Status": "Final",25"Units": null,26"Value": "1",27"ValueType": "Coded Entry"28},29{30"AbnormalFlag": null,31"Code": "93269-9",32...33"Status": "Final",34"Units": null,35"Value": "0",36"ValueType": "Coded Entry"37}38],
1$.Observations
1items:2if:3operator: includes4terms:5- concat:6- constant: NF15704005047- constant: NF15704001818- constant: 93374-79- get: Code10then:11omit: true12else:13comment: do pass observation through
Based on this example config modifier, the output would be:
1"Observations": [2{3"AbnormalFlag": null,4"Code": "93246-7",5...6"Status": "Final",7"Units": null,8"Value": "1",9"ValueType": "Coded Entry"10},11{12"AbnormalFlag": null,13"Code": "93247-5",14...15"Status": "Final",16"Units": null,17"Value": "1",18"ValueType": "Coded Entry"19},20{21"AbnormalFlag": null,22"Code": "93267-3",23...24"Status": "Final",25"Units": null,26"Value": "1",27"ValueType": "Coded Entry"28},29{30"AbnormalFlag": null,31"Code": "93269-9",32...33"Status": "Final",34"Units": null,35"Value": "0",36"ValueType": "Coded Entry"37}38],
This example config modifier checks if the string value at FT1.13.1 includes a substring of a dash (-). If the string does include a dash (-), then it should split and place the first part of the string in PV1.3.1 and the second part of the string after the dash (-) in PV1.3.4.1. If it doesn’t include dash (-), then it’ll map from the initial payload’s Financial[0].Department.Code (from a Financials data model message).
1{2...,3"FINANCIAL": [4{5"FT1": {6"1": 1,7"10": "1",8"11": {9"1": {10"1": null11}12},13"13": {14"1": "SVHCROSCAR-MONTICELO",15"2": null,16"3": null17},18...19}20}21],22...,23"PV1": {24"19": {25"1": "2000708548"26},27"3": {28"1": null29},30"44": {31"1": null32}33}34}
1$.PV1.3
1references:2departmentCode:3use: processedPayload4get: FINANCIAL[0].FT1.13.15if:6operator: includes7terms:8- use: departmentCode9plugin:10name: text11action: lower-case12- constant: '-'13then:14pipe:15- use: departmentCode16plugin:17name: text18action: split19parameters:20separator: '-'21- properties:22'1':23get: '0'24'4':25properties:26'1':27get: '1'28else:29use: initialPayload30get: Transactions[0].Department.Code
Based on this example config modifier, the output would be:
1{2...,3"FINANCIAL": [4{5"FT1": {6"1": 1,7"10": "1",8"11": {9"1": {10"1": null11}12},13"13": {14"1": "SVHCROSCAR-MONTICELO",15"2": null,16"3": null17},18...,19}20],21"PV1": {22"19": {23"1": "2000708548"24},25"3": {26"1": "SVHCROSCAR",27"4": {28"1": "MONTICELO"29}30},31"44": {32"1": null33}34}35}
Defines a sequential array of keywords to execute on. All terms are evaluated in sequence, then the related operator performs the appropriate action. You can review the requirements for terms based on the operator used.
Within the context of a terms keyword statement, you can use {} to retrieve a value at the already defined selector instead of repeating the same path. Learn about referring to a selector.
These keywords are used in conjunction with each other to define which action should happen when:
- Execute the then action when the operator resolves to a true state.
- Execute the else action when the operator resolves to a false state.
For example, you could define which fields to use to build an object.
1{2"Orders": [3{4"ApplicationOrderID": "844",5"ClinicalInfo": [],6"CollectionDateTime": "2025-05-29T14:59:00.000Z",7"Comments": null,8"Diagnoses": [9{10"Code": "Z13.71",11"Codeset": "ICD-10",12"DocumentedDateTime": null,13"Name": "Encounter for nonprocreative screening for genetic disease carrier status",14"Type": "Unknown"15}16],17...18"Procedure": {19"Code": "523",20"Codeset": "GDXEAP",21"Description": "GDX NEURO-NDD"22},23...24"Status": "Update",25"TransactionDateTime": "2025-05-29T14:59:25.000Z"26}27],28}
1$.Orders[*].Procedure.Code
1if:2operator: equals3terms:4- {}5- constant: '523'6then:7constant: '691'8else:9comment: pass original value
During processing, the request checks if the procedure code equals 523 in the initial payload. If so, the then action executes, meaning that the procedure code is set to 691. If the procedure code doesn’t equal 523, the else action executes, meaning that the original procedure code is passed.
1"Orders": [2{3"ApplicationOrderID": "844",4"ClinicalInfo": [],5"CollectionDateTime": "2025-05-29T14:59:00.000Z",6"Comments": null,7"Diagnoses": [8{9"Code": "Z13.71",10"Codeset": "ICD-10",11"DocumentedDateTime": null,12"Name": "Encounter for nonprocreative screening for genetic disease carrier status",13"Type": "Unknown"14}15],16...17"Procedure": {18"Code": "691", <--- this is the change here19"Codeset": "GDXEAP",20"Description": "GDX NEURO-NDD"21},22...23"Status": "Update",24"TransactionDateTime": "2025-05-29T14:59:25.000Z"25}26],
FHIR® is a registered trademark of Health Level Seven International (HL7) and is used with the permission of HL7. Use of this trademark does not constitute an endorsement of products/services by HL7®.