Inconsistencies in validation for type Coding and binding strength extensible

54 views
Skip to first unread message

Deepak George Chacko

unread,
Jun 1, 2025, 7:46:32 AM6/1/25
to HAPI FHIR
Hi,
We are noticing some inconsistencies in the validation of terminology data when migrating from version 7.2.1 to 7.6.1 (and also 8.0.0+). Specifically, for a field of type Coding with binding strength extensible, an invalid code throws a WARNING, whereas for binding strengths preferred and example, an ERROR is thrown. In contrast, for fields of type CodeableConcept, an ERROR is thrown for invalid codes regardless of the binding strength.

In version 7.2.1, an ERROR was thrown for Coding with extensible strength (and all others mentioned). However, from version 7.6.1 onwards, a WARNING is thrown only for Coding of extensible binding strength.

We would like to understand whether this is the expected behaviour.

To reproduce:
The below payload was validated using the hapi cli as well as via http://hapi.fhir.org/
payload:
{
"resourceType": "Contract",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">A human-readable rendering of the contract</div>"
},
"legalState": {
"coding": [
{
"code": "invalid-code-test"
}
]
},
"term": [
{
"offer": {
"text": "Can't refuse"
},
"securityLabel": [
{
"classification": {
"code": "invalid-code-test"
}
}
],
"asset": [
{
"type": [
{
"coding": [
{
"code": "invalid-code-test"
}
]
}
],
"relationship": {
"code": "invalid-code-test"
}
}
]
}
]
}


result in 8.2.0 (same as 7.6.1):
Issue 1: ERROR - Contract.legalState
         Unknown code
         'http://hl7.org/fhir/contract-legalstate#invalid-code-test'
Issue 2: WARNING - Contract.legalState
         None of the codings provided are in the value set 'Contract Resource
         Legal State codes'
         (http://hl7.org/fhir/ValueSet/contract-legalstate|4.0.1), and a coding
         should come from this value set unless it has no suitable code (note
         that the validator cannot judge what is suitable) (codes =
         http://hl7.org/fhir/contract-legalstate#invalid-code-test)
Issue 3: ERROR - Contract.term[0].securityLabel[0].classification
         Unknown code
         'http://hl7.org/fhir/contract-security-classification#invalid-code-test
         '
Issue 4: ERROR - Contract.term[0].asset[0].type[0]
         Unknown code
         'http://hl7.org/fhir/contract-asset-type#invalid-code-test'
Issue 5: WARNING - Contract.term[0].asset[0].relationship
         The Coding provided
         (http://hl7.org/fhir/resource-types#invalid-code-test) was not found in
         the value set 'Consent Content Class'
         (http://hl7.org/fhir/ValueSet/consent-content-class|4.0.1), and a code
         should come from this value set unless it has no suitable code (note
         that the validator cannot judge what is suitable).  (error message =
         Unknown code 'http://hl7.org/fhir/resource-types#invalid-code-test' for
         in-memory expansion of ValueSet
         'http://hl7.org/fhir/ValueSet/consent-content-class')

result in 7.2.1
Issue 1: WARNING - Contract.legalState
         None of the codings provided are in the value set 'Contract Resource
         Legal State codes'
         (http://hl7.org/fhir/ValueSet/contract-legalstate|4.0.1), and a coding
         should come from this value set unless it has no suitable code (note
         that the validator cannot judge what is suitable) (codes =
         http://hl7.org/fhir/contract-legalstate#invalid-code-test)
Issue 2: ERROR - Contract.legalState.coding[0]
         Unknown code
         'http://hl7.org/fhir/contract-legalstate#invalid-code-test' for
         'http://hl7.org/fhir/contract-legalstate#invalid-code-test'
Issue 3: ERROR - Contract.term[0].securityLabel[0].classification
         Unknown code
         'http://hl7.org/fhir/contract-security-classification#invalid-code-test
         ' for
         'http://hl7.org/fhir/contract-security-classification#invalid-code-test
         '
Issue 4: ERROR - Contract.term[0].asset[0].type[0].coding[0]
         Unknown code
         'http://hl7.org/fhir/contract-asset-type#invalid-code-test' for
         'http://hl7.org/fhir/contract-asset-type#invalid-code-test'
Issue 5: ERROR - Contract.term[0].asset[0].relationship
         Unknown code 'http://hl7.org/fhir/resource-types#invalid-code-test' for
         'http://hl7.org/fhir/resource-types#invalid-code-test'

Thanks!

Reply all
Reply to author
Forward
0 new messages