Page Status: Outdated

ValueSet - Fetch

Page index

Introduction

This section describes the process of fetching ValueSet(s).

The basic approach to achieve this use case is an HTTP GET on ValueSet. For example:

GET [base]/ValueSet/nll-snomed-method

Se ValueSet for a complete list of query options.

Sequence diagram

The diagram below shows the typical sequence needed to fetch value sets. No authorization token is needed to access the ValueSet resource.

Note that the requests shown in the diagram doesn't include the full basepath. It only shows the last part of the http request including resource and possible search/query parameters.

See the generic example for other type of responses.

Examples

Example 1 - fetch all value sets

This example shows how to fetch all present and active value sets. The response will include a bundle with an entry element for each value set.

Request

GET [base]/ValueSet

Response

{
  "resourceType": "Bundle",
  "type": "searchset",
  "entry": [
    {
      "fullUrl": "http://.../fhir/ValueSet/nll-snomed-method",
      "search": {
        "mode": "match"
      },
      "resource": {
        "resourceType": "ValueSet",
...

Example 2 - fetch a specific value set based on logical id

This example shows how to fetch a specific value set. Note that the logical id for most value sets is a kebab case string. In the example below the logical id is nll-snomed-method

Request

GET [base]/fhir/ValueSet/nll-snomed-method

Response

{
  "resourceType": "ValueSet",
  "id": "nll-snomed-method",
  "meta": {
    "profile": [
      "http://electronichealth.se/fhir/StructureDefinition/NLLValueSet"
    ]
  },
  "url": "http://electronichealth.se/fhir/ValueSet/nll-snomed-method",
  "identifier": [
    {
      "value": "nll-snomed-method_0.9.0",
      "period": {
        "start": "2020-02-13T13:19:33+01:00"
      }
    }
  ],
  "version": "0.9.0",
  "title": "Administreringsmetod",
  "status": "active",
  "date": "2020-02-13T13:19:33+01:00",
  "publisher": "E-hälsomyndigheten",
  "description": "Snomed CT koder för administreringsmetoder. Administreringsmetod är den metod som används för att tillföra läkemedlet till kroppen, t.ex. infusion eller injektion.",
  "compose": {
    "include": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
        "version": "2018-08-12",
        "concept": [
          {
            "code": "OTH",
            "display": "Annan"
          }
        ]
      },
      {
        "system": "http://snomed.info/sct",
        "version": "Swedish Edition 2019-11-30",
        "concept": [
          {
            "code": "738992009",
            "display": "tuggning",
            "designation": [
              {
                "language": "sv",
                "use": {
                  "system": "http://snomed.info/sct",
                  "code": "900000000000013009",
                  "display": "Synonym"
                },
                "value": "tuggas"
              }
            ]
          },
...
etc

Example 3 - fetch all versions of a value set

This example shows how to fetch all versions, both active and historical of a specific value set. The request is based on the form GET [basepath]/fhir/ValueSet/[id]/_history and notice in the two entries of the response that one is active and one is retired (historical)

Request

GET [base]/fhir/ValueSet/nll-valueset-example/_history

Response

{
  "resourceType": "Bundle",
  "id": "1e5770c9-6981-45a7-8f61-4c459d386181",
  "meta": {
    "lastUpdated": "2020-02-17T08:32:31.833+01:00"
  },
  "type": "history",
  "total": 2,
  "link": [
    {
      "relation": "self",
      "url": "http://...fhir/ValueSet/nll-valueset-example/_history"
    }
  ],
  "entry": [
    {
      "fullUrl": "http://.../fhir/ValueSet/nll-valueset-example",
      "resource": {
        "resourceType": "ValueSet",
        "id": "nll-valueset-example",
        "meta": {
          "profile": [
            "http://electronichealth.se/fhir/StructureDefinition/NLLValueSet"
          ]
        },
        "url": "https://basepath.se/fhir/ValueSet/nll-valueset-example",
        "identifier": [
          {
            "value": "nll-valueset-example_2.0",
            "period": {
              "start": "2019-09-01T00:00:00+02:00",
              "end": "2020-12-17T08:32:06+01:00"
            }
          }
        ],
        "version": "2.0",
        "title": "VardeMängd Test example",
        "status": "active",
...
{
      "fullUrl": "http://.../fhir/ValueSet/nll-valueset-example",
      "resource": {
        "resourceType": "ValueSet",
        "id": "nll-valueset-example",
        "meta": {
          "profile": [
            "http://electronichealth.se/fhir/StructureDefinition/NLLValueSet"
          ]
        },
        "url": "https://basepath.se/fhir/ValueSet/nll-valueset-example",
        "identifier": [
          {
            "value": "nll-valueset-example_1.0",
            "period": {
              "start": "2019-07-01T00:00:00+02:00",
              "end": "2019-09-01T00:00:00+02:00"
            }
          }
        ],
        "version": "1.0",
        "title": "VardeMängd Test example",
        "status": "retired",
        "date": "2019-09-01T00:00:00+02:00",

Example 4 - validate code

This example shows how to use the operation $validate-code to ensure that a specific code is part of a value set or to fetch its corresponding term. The code, in the example below, is 302497006 and the value set to validate against is nll-snomed-method

Request

GET [base]/fhir/ValueSet/nll-snomed-method/$validate-code/?code=302497006

Response

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "result",
      "valueBoolean": true
    },
    {
      "name": "message",
      "valueString": "Koden \"302497006\" existerar."
    },
    {
      "name": "display",
      "valueString": "hemodialys"
    }
  ]
}