How to publish a FHIR profile that enables automatic JSON validation?

Hello All,

I am publishing a FIHR spec for a project of ours. I need to publish our resources in a way that can be used for automatic JSON validation by the server.

Existing tools that I know of (lantana’s Trifolia, Forge, ClinFHIR) only generate StructureDefinition or some customized format to describe your local FHIR profile. To the best of my knowledge, there are no APIs that can these custom formats or FHIR Structure Definition to validate incoming JSON based resources by the server.

Here are my questions:

  1. Are there APIs that can use FHIR Structure Definition to validate incoming JSON based resources?
  2. How should I publish my FHIR profile to enable automatic JSON validation?

Appreciate your help.

Borna

P.S. I see that HAPI FHIR enables you to do StructureDefinition validation. However, if it is customized, it seems that you have to do some coding. Any comments on that as well?

have you looked at this page?
http://hl7.org/fhir/validation.html

Thanks for the link. Yes I have. But, this page says how to validate against DSTU2. It does not say how to validate JSON documents for localized versions of resources (that I will be developing for Ontario).

when you validate, you can nominate the profile against which you want the validation to occur. The example for the validator shows validating a patient against the DAF profiles. You’d just use your own profile instead. Same for asking a FHIR server to validate against your profile: upload your profile to the FHIR server, then nominate it when validating

So the DAF schema already exists in the validation-min.xml.zip file that you download from hl7.org. But, I have my own StructureDefinition. For example, consider the StructureDefinition at the end of this post. This is my customized definition of the patient that I have generated using Trifolia. I am trying to validate resources against the StructureDefinition below. I’m not sure how to do that.

You’d just use your own profile instead.” How would I do that?

Thanks.

{
“resourceType”: “StructureDefinition”,
“url”: “https://www.fhir.ca/api/test/FHIR2/patient”,
“name”: “Patient”,
“status”: “draft”,
“publisher”: “publisher”,
“contact”: [
{
“name”: “borna”,
“telecom”: [
{
“system”: “phone”,
“value”: “44444444444”,
“use”: “work”
},
{
“system”: “email”,
“value”: “xyz@abc.ca”,
“use”: “work”
}
]
}
],
“description”: "this is the patient resource for EHO’s ",
“kind”: “resource”,
“constrainedType”: “Patient”,
“abstract”: false,
“base”: “http://hl7.org/fhir/StructureDefinition/Patient”,
“differential”: {
“element”: [
{
“path”: “Patient”
},
{
“path”: “Patient.id”,
“short”: “id”,
“definition”: “MAY contain exactly one [1…1] id (CONF:3248-1).”,
“min”: 1,
“max”: “1”
},
{
“path”: “Patient.gender”,
“short”: “gender”,
“definition”: “SHOULD contain exactly one [1…1] gender, which SHALL be selected from ValueSet FHIR AdministrativeGender http://hl7.org/fhir/v3/vs/AdministrativeGender (CONF:3248-4).”,
“min”: 1,
“max”: “1”,
“type”: [
{
“code”: “code”
}
],
“binding”: {
“strength”: “required”,
“valueSetReference”: {
“reference”: “ValueSet/2905”,
“display”: “FHIR AdministrativeGender”
}
}
},
{
“path”: “Patient.address”,
“short”: “address”,
“definition”: “MAY contain zero or more [0…] address (CONF:3248-2).",
“min”: 0,
“max”: "

},
{
“path”: “Patient.address.type”,
“short”: “type”,
“definition”: “The address, if present, MAY contain zero or one [0…1] type (CONF:3248-3).”,
“min”: 0,
“max”: “1”
}
]
}
}{
“resourceType”: “StructureDefinition”,
“url”: “https://www.ehealthontario.on.ca/api/eConsult/FHIR2/patient”,
“name”: “EHO FHIR eConsult Patient”,
“status”: “draft”,
“publisher”: “eHealth Ontario”,
“description”: "this is the patient resource for EHO’s ",
“kind”: “resource”,
“constrainedType”: “Patient”,
“abstract”: false,
“base”: “http://hl7.org/fhir/StructureDefinition/Patient”,
“differential”: {
“element”: [
{
“path”: “Patient”
},
{
“path”: “Patient.id”,
“short”: “id”,
“definition”: “MAY contain exactly one [1…1] id (CONF:3248-1).”,
“min”: 1,
“max”: “1”
},
{
“path”: “Patient.gender”,
“short”: “gender”,
“definition”: “SHOULD contain exactly one [1…1] gender, which SHALL be selected from ValueSet FHIR AdministrativeGender http://hl7.org/fhir/v3/vs/AdministrativeGender (CONF:3248-4).”,
“min”: 1,
“max”: “1”,
“type”: [
{
“code”: “code”
}
],
“binding”: {
“strength”: “required”,
“valueSetReference”: {
“reference”: “ValueSet/2905”,
“display”: “FHIR AdministrativeGender”
}
}
},
{
“path”: “Patient.address”,
“short”: “address”,
“definition”: “MAY contain zero or more [0…] address (CONF:3248-2).",
“min”: 0,
“max”: "

},
{
“path”: “Patient.address.type”,
“short”: “type”,
“definition”: “The address, if present, MAY contain zero or one [0…1] type (CONF:3248-3).”,
“min”: 0,
“max”: “1”
}
]
}
}

if you’re using the java validator, add one or more -folder parameters that specifies where to find your additional structure definitions (and also value sets etc that support it). Then nominate the canonical URL in place of the the DAF one.

if you’re using the server, upload your structure definition and supporting value sets etc to the server, and then nominate your canonical URL in place of the DAF one.