Shuail_CR007
Shuail_CR007

Reputation: 312

FHIR : How to check whether the exposed JSON is in proper FHIR standard

We have created a patient resource using FHIR, is there any tool or mechanism to validate whether the created JSON Object is in proper FHIR standard ,

Upvotes: 3

Views: 1339

Answers (4)

Shuail_CR007
Shuail_CR007

Reputation: 312

Finally got it .... FHIR Validator using a jar

1.Install java 1.7 2.Download the jar from the link (https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.validator.jar) 3.Double click the jar it will get installed 4.Place the json of patient resource in a specific path and refer the path to the below command . if output of the resource validator is required then specify the path for that to. command : java -jar org.hl7.fhir.validator.jar c:\temp\patient.json -output c:\temp\validation.json

Upvotes: 1

Yusubov
Yusubov

Reputation: 5843

One way is to run validation operation on supported FHIR resource, with precondition to check FHIR server capability statement for support. Example: URL: [base]/Resource/$validate

Check this HL7 FHIR post on validation: Validate a resource

Upvotes: 0

Jaime
Jaime

Reputation: 5975

If you are using HAPI and Java, you can use the IParser.parseResource() method, as shown here:

        FhirContext fhirCtx = FhirContext.forDstu3(); // DSTU3
        IParser p = fhirCtx.newJsonParser();
        p.setParserErrorHandler(new StrictErrorHandler());

        try {
            p.parseResource(jsonAsString); // Pass your Patient's JSON string here
        } catch (Exception e) {
            // Do something here
        }

Upvotes: 0

Grahame Grieve
Grahame Grieve

Reputation: 3586

See FHIR Validation from the FHIR Spec.

Upvotes: 1

Related Questions