Validate a CodeSystem code

Check whether a code exists in a FHIR CodeSystem and whether its display is correct.

$validate-code checks whether a code belongs to a CodeSystem. It can also validate a supplied display and return the preferred display for the code.

MethodPath
GET or POST/fhir/R4/CodeSystem/$validate-code

At the type-level route, identify the CodeSystem with url (or provide a CodeSystem resource using codeSystem). Supply exactly one code input: a code, a Coding, or a CodeableConcept.

GET request

curl --get 'https://api.sandbox.ovok.com/fhir/R4/CodeSystem/$validate-code' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --data-urlencode 'url=http://loinc.org' \
  --data-urlencode 'code=8867-4' \
  --data-urlencode 'display=Heart rate'

POST request

Send the CodeSystem canonical URL and code together in a FHIR Parameters resource:

curl --request POST \
  --url 'https://api.sandbox.ovok.com/fhir/R4/CodeSystem/$validate-code' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/fhir+json' \
  --data @validate-codesystem-parameters.json

Example validate-codesystem-parameters.json:

{
  "resourceType": "Parameters",
  "parameter": [
    { "name": "url", "valueUri": "http://loinc.org" },
    {
      "name": "coding",
      "valueCoding": {
        "system": "http://loinc.org",
        "code": "8867-4",
        "display": "Heart rate"
      }
    }
  ]
}

Successful response

The operation returns a FHIR Parameters resource.

Response pathExampleMeaning
resourceTypeParametersFHIR wrapper for the operation output.
parameter[name=result].valueBooleantrueWhether the code is valid in the CodeSystem.
parameter[name=display].valueStringHeart rateCanonical display for the code, when available. A supplied display can be checked according to the CodeSystem's case-sensitivity rules.
parameter[name=message].valueStringOptionalValidation failure details or a hint, when present.

Errors are returned as a FHIR OperationOutcome. The server may reject unknown systems, malformed inputs, or codes it cannot validate.

Reference: HL7 FHIR R4 CodeSystem $validate-code.

Last updated on

On this page