CodeSystem Code Composition

Last updated 4 months ago

Overview

Given a set of properties, return one or more possible matching codes. For more details see official FHIR terminology documentation CodeSystem Code Composition

$compose may return 3 possible types of match

  • complete match - a code that represents all the provided properties correctly

  • partial match - a code that represents some of the provided properties correctly, and not others

  • possible match - code that may represent the provided properties closely,

When send exact parameter is true - $compose operation return only complete and partial matches. When exact is false - $compose include in to response possible matches. Default value is true, that means, that by default returning only complete and partial matches.

Api

GET/POST URL: [base]/ValueSet/$compose
GET/POST URL: [base]/ValueSet/[id]/$compose

Parameters

Parameter

Type

Status

Example

system

uri

supported

property

version

string

not supported

exact

boolean

supported

exact

property

supported

property

property.code

code

supported

property.value

code | Coding | string |

integer | boolean | dateTime

supported

property.subproperty

not supported

property.subproperty.code

code

not supported

property.subproperty.value

code | Coding | string |

integer | boolean | dateTime

not supported

compositional

boolean

not supported

property

One or more properties that contain information to be composed into the code.

Example: Compose from system http://hl7.org/fhir/goal-status where code is proposed

Request
Response
POST [BASE]/CodeSystem/$compose
{
"resourceType" : "Parameters",
"parameter" : [
{
"name" : "system",
"valueUri" : "http://hl7.org/fhir/goal-status"
},
{
"name" : "exact",
"valueUri" : true
},
{
"name": "property",
"part": [
{
"name": "code",
"valueCode": "code"
},
{
"name": "value",
"valueString": "proposed"
}]
}
]
}
{
"resourceType": "Parameters",
"parameter": [
{
"name": "match",
"part": [
{
"name": "code",
"valueCoding": {
"code": "proposed",
"module": "fhir-3.3.0",
"system": "http://hl7.org/fhir/goal-status",
"display": "Proposed",
"definition": "A goal is proposed for this patient"
}
}
]
}
]
}

Example: Compose from system http://hl7.org/fhir/goal-status where code is proposed or accepted

Request
Response
POST [BASE]/CodeSystem/$compose
{
"resourceType" : "Parameters",
"parameter" : [
{
"name" : "system",
"valueUri" : "http://hl7.org/fhir/goal-status"
},
{
"name" : "exact",
"valueUri" : true
},
{
"name": "property",
"part": [
{
"name": "code",
"valueCode": "code"
},
{
"name": "value",
"valueString": "proposed"
},
{
"name": "value",
"valueString": "accepted"
}]
}
]
}
{
"resourceType": "Parameters",
"parameter": [
{
"name": "match",
"part": [
{
"name": "code",
"valueCoding": {
"code": "accepted",
"module": "fhir-3.3.0",
"system": "http://hl7.org/fhir/goal-status",
"display": "Accepted",
"definition": "A proposed goal was accepted or acknowledged"
}
},
{
"name": "code",
"valueCoding": {
"code": "proposed",
"module": "fhir-3.3.0",
"system": "http://hl7.org/fhir/goal-status",
"display": "Proposed",
"definition": "A goal is proposed for this patient"
}
}
]
}
]
}

Example: Compose from system http://hl7.org/fhir/goal-status where code is proposed or accepted and/or where definition is Planned

Request
Response
POST [BASE]/CodeSystem/$compose
{
"resourceType" : "Parameters",
"parameter" : [
{
"name" : "system",
"valueUri" : "http://hl7.org/fhir/goal-status"
},
{
"name" : "exact",
"valueUri" : true
},
{
"name": "property",
"part": [
{
"name": "code",
"valueCode": "code"
},
{
"name": "value",
"valueString": "proposed"
},
{
"name": "value",
"valueString": "accepted"
}]
},
{
"name": "property",
"part": [
{
"name": "code",
"valueCode": "display"
},
{
"name": "value",
"valueString": "Planned"
}]
}
]
}
{
"resourceType": "Parameters",
"parameter": [
{
"name": "match",
"part": [
{
"name": "code",
"valueCoding": {
"code": "accepted",
"module": "fhir-3.3.0",
"system": "http://hl7.org/fhir/goal-status",
"display": "Accepted",
"definition": "A proposed goal was accepted or acknowledged"
}
},
{
"name": "code",
"valueCoding": {
"code": "proposed",
"module": "fhir-3.3.0",
"system": "http://hl7.org/fhir/goal-status",
"display": "Proposed",
"definition": "A goal is proposed for this patient"
}
},
{
"name": "code",
"valueCoding": {
"code": "planned",
"module": "fhir-3.3.0",
"system": "http://hl7.org/fhir/goal-status",
"display": "Planned",
"hierarchy": [
"accepted"
],
"definition": "A goal is planned for this patient"
}
}
]
}
]
}

exact

Whether the operation is being used by a human, or a machine. When false include to response possible matches.

Example: lets try to compose code system from concepts where code contains on-

Request
Response
POST [BASE]/CodeSystem/$compose
{
"resourceType" : "Parameters",
"parameter" : [
{
"name" : "system",
"valueUri" : "http://hl7.org/fhir/goal-status"
},
{
"name" : "exact",
"valueUri" : false
},
{
"name": "property",
"part": [
{
"name": "code",
"valueCode": "code"
},
{
"name": "value",
"valueString": "on-"
}]
}
]
}
{
"resourceType": "Parameters",
"parameter": [
{
"name": "match",
"part": [
{
"name": "code",
"valueCoding": {
"code": "on-target",
"module": "fhir-3.3.0",
"system": "http://hl7.org/fhir/goal-status",
"display": "On Target",
"hierarchy": [
"accepted",
"in-progress"
],
"definition": "The goal is on schedule for the planned timelines"
}
},
{
"name": "code",
"valueCoding": {
"code": "on-hold",
"module": "fhir-3.3.0",
"system": "http://hl7.org/fhir/goal-status",
"display": "On Hold",
"hierarchy": [
"accepted"
],
"definition": "The goal remains a long term objective but is no longer being actively pursued for a temporary period of time."
}
}
]
}
]
}