FHIR ValueSet/$validate-code membership check
const options = {method: 'GET'};
fetch('https://fhir.omophub.com/fhir/{version}/ValueSet/$validate-code', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url 'https://fhir.omophub.com/fhir/{version}/ValueSet/$validate-code'import requests
url = "https://fhir.omophub.com/fhir/{version}/ValueSet/$validate-code"
response = requests.get(url)
print(response.text){
"resourceType": "Parameters",
"parameter": [
{ "name": "result", "valueBoolean": true },
{ "name": "display", "valueString": "Type 2 diabetes mellitus" }
]
}
FHIR ValueSet/$validate-code membership check
Check whether an OMOP code is a member of a specified FHIR ValueSet - validate Observations, Conditions, and Medications against expected sets.
FHIR ValueSet/$validate-code membership check
const options = {method: 'GET'};
fetch('https://fhir.omophub.com/fhir/{version}/ValueSet/$validate-code', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url 'https://fhir.omophub.com/fhir/{version}/ValueSet/$validate-code'import requests
url = "https://fhir.omophub.com/fhir/{version}/ValueSet/$validate-code"
response = requests.get(url)
print(response.text){
"resourceType": "Parameters",
"parameter": [
{ "name": "result", "valueBoolean": true },
{ "name": "display", "valueString": "Type 2 diabetes mellitus" }
]
}
Overview
Validates whether a code is a member of an implicit ValueSet. EHRbase uses this during composition validation to check if a submitted code falls within the allowed set for a template field. Supports the same ValueSet URL patterns as$expand.
FHIR clients typically call ValueSet
search first as a preflight
check to confirm the server supports the target ValueSet, then call
$validate-code (or $expand) for the actual membership test. The two
endpoints are independent - you can call $validate-code directly without the
preflight if you already know the URL is supported.Contract Parameters
string
default:"r4"
string
required
Implicit ValueSet URL.
string
System of the code; defaults to the ValueSet system.
string
required
Code to validate.
string
Expected display text.
Supported Patterns
All codes in a code system
curl "https://fhir.omophub.com/fhir/r4/ValueSet/\$validate-code?\
url=http://snomed.info/sct?fhir_vs&\
system=http://snomed.info/sct&code=44054006" \
-H "Authorization: Bearer YOUR_API_KEY"
Descendants of a concept (is-a filter)
curl "https://fhir.omophub.com/fhir/r4/ValueSet/\$validate-code?\
url=http://snomed.info/sct?fhir_vs=isa/73211009&\
system=http://snomed.info/sct&code=44054006" \
-H "Authorization: Bearer YOUR_API_KEY"
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | uri | Yes | Implicit ValueSet URL (e.g., http://snomed.info/sct?fhir_vs or http://snomed.info/sct?fhir_vs=isa/73211009) |
system | uri | No | Code system URI of the code being validated (defaults to the ValueSet system) |
code | code | Yes | The code to validate |
display | string | No | Expected display text to verify |
Response (valid code)
Response Fields
string
Always
Parameters.array
FHIR result parameters.
string
result, display, or message.boolean | null
Membership result.
string | null
Display or explanatory message.
{
"resourceType": "Parameters",
"parameter": [
{ "name": "result", "valueBoolean": true },
{ "name": "display", "valueString": "Type 2 diabetes mellitus" }
]
}
Response (not a member)
{
"resourceType": "Parameters",
"parameter": [
{ "name": "result", "valueBoolean": false },
{
"name": "message",
"valueString": "Code '22298006' is not a member of the ValueSet (not a descendant of '73211009')."
}
]
}
Response (display mismatch)
{
"resourceType": "Parameters",
"parameter": [
{ "name": "result", "valueBoolean": true },
{ "name": "display", "valueString": "Type 2 diabetes mellitus" },
{
"name": "message",
"valueString": "Display mismatch: provided 'Diabetes type 2', actual 'Type 2 diabetes mellitus'."
}
]
}
Errors
| HTTP | Issue Code | Cause |
|---|---|---|
| 400 | invalid | Missing url or code parameter, invalid ValueSet URL, or unknown code system |
| 404 | not-found | ValueSet root concept not found |
Was this page helpful?