FHIR Terminology Ecosystem IG
1.7.6 - Release International flag

This page is part of the HL7 Terminology Ecosystem IG (v1.7.6: Releases - Informative) based on FHIR (HL7® FHIR® Standard) v5.0.0. This is the current published version. For a full list of available versions, see the Directory of published versions

R4 and Test Cases

R4 and the Test Cases

The test cases are expressed in R5, but are intended to test R4 servers as well (in fact, most servers that are tested are R4 servers).

How R4 testing works is that the Test Case runner that runs when the validator runs the test cases looks at the server capability statement, and sees that it's an R4 server (based on CapabiltityStatement.fhirVersion), and then converts all the requests amd responses between R5 and R4 on the fly.

The /tests directory contains a /test/r4 subdirectory that contains a copy of all the requests converted to R4 to help with understanding the conversion process. Unfortunately, because the responses are not valid resources, there's no similar conversion process.

This documentation has to suffice.

Properties in Expansions

The main difference is around ValueSet.expansion.property and ValueSet.expansion.contains.property. The Test Case runner uses cross-version extensions for these in R4. Here's an example in R5 for a response with properties:

  "expansion" : {
    "property" : [{
      "code" : "definition",
      "uri" : "http://hl7.org/fhir/concept-properties#definition"
    }],
  }

Note: some JSON properties have been omitted.

Here's the same definition in R4:

  "expansion" : {
    "extension" : [{
      "extension" : [{
        "url" : "uri",
        "valueUri" : "http://hl7.org/fhir/concept-properties#definition"
      },
      {
        "url" : "code",
        "valueCode" : "definition"
      }],
      "url" : "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.property"
    }]
  }

Properties on contained entries are similar. R5:

  "contains" : [{
    "system" : "http://hl7.org/fhir/test/CodeSystem/simple",
    "code" : "code1",
    "display" : "Display 1",
    "designation" : [{
      "use" : {
        "system" : "http://hl7.org/fhir/test/CodeSystem/designations",
        "code" : "olde-english"
      },
      "value" : "mine own first code"
    }],
    "property" : [{
      "code" : "definition",
      "valueString" : "My first code"
    }]
  }]

and in R4:

  "contains" : [{
    "extension" : [{
      "extension" : [{
        "url" : "code",
        "valueCode" : "definition"
      },
      {
        "url" : "value",
        "valueString" : "My first code"
      }],
      "url" : "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property"
    }],
    "system" : "http://hl7.org/fhir/test/CodeSystem/simple",
    "code" : "code1",
    "display" : "Display 1",
    "designation" : [{
      "use" : {
        "system" : "http://hl7.org/fhir/test/CodeSystem/designations",
        "code" : "olde-english"
      },
      "value" : "mine own first code"
    }]
  }]