Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To download the validator: [https://storage.googleapisgithub.com/ig-buildhapifhir/org.hl7.fhir.core/releases/latest/download/validator_cli.jar]

Running the validator

Note that you should always use the current validator (see above), irrespective of which FHIR Release you are validating. You need a current version of java to run the validator:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar [params]

The params control how the validator works, and are documented here.

...

All other parameters are 'named parameters' - e.g. -name value. Any parameter preceded by a recognised name is interpreted as a source parameter

 java -jar org.hl7.fhir.validatorvalidator_cli.jar /tmp/resource.json

or

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml

Managing Output

...

If the parameter -output is defined, a file will be created to contain the output. The file will contain an OperationOutcome, or if more than one resource is found, a Bundle of OperationOutcome resources

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -output c:\temp\validation.xml

...

The validator checks the resource against the base specification. By default, this is the current build version of the specification. You probably don't want to validate against that version, so the first thing to do is to specify which version of the spec to use.

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0

...

Note: alternatively, you can specify the version -defn or -ig parameters:

 java -jar org.hl7.fhir.validator.jarvalidator_cli.jar c:\temp\patient.xml -defn hl7.fhir.r3.core#3.0.2
 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -ig hl7.fhir.r3.core

...

Tell the validator to load the package for an implementation guide using the -ig parameter:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -ig hl7.fhir.us.core#1.0.1

The package validator loads the relevant implementation guide. Rather than nominating the the package id, you can also provide the canonical url of the implementation guide:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -ig http://hl7.org/fhir/us/core%7C1.0.1

You don't have to specify the version:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -ig hl7.fhir.us.core
 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -ig http://hl7.org/fhir/us/core

...

  • a URL that returns a relevant resource (profile, extension definition, code system or value set) to load
  • the name of a file that contains relevant resource to load, i.e. this can be a single profile file
  • the name of a directory that contains relevant resources (scan and load *.xml, *.json, and *.ttl - any that can be parsed)

Notes:

  • Packages will be installed in yourthe name of a gzipped tarball (e.g. package.tgz) that contains the relevant resources to load

Notes:

  • Packages will be installed in your FHIR Package Cache as required
  • Packages must have the same underlying fhir version as that specified in the -version parameter
  • if you want to validate against the current build version (pre-publication) of an implementation guide auto-published through build.fhir.org, use 'current' as the version
  • if you want to validate against an implementation that you built yourself using the IG publisher on your own machine, use 'dev' as the version
  • if you have problems with an implementation guide, please ask on [the conformance stream on chat.fhir.org]
  • you can load more than one version of an implementation guide, though this is not usually very useful
 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -ig hl7.fhir.us.core#1.0.1 -ig hl7.fhir.us.core#1.1.0

...

Use the -profile parameter to tell the validator what to validate against:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -ig hl7.fhir.us.core#1.0.1 -profile http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient

...

You can nominate more than one profile to validate against

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -ig hl7.fhir.us.core#1.0.1 -profile http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient -profile http://example.org/fhir/StructureDefinition/example

If the Implementation Guide specifies a global profile that applies to all uses of a conformance resource, then you can nominate the canonical URL of the implementation guide resource itself:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -ig hl7.fhir.us.core#1.0.1 -profile http://hl7.org/fhir/us/core

...

Specifies the locale/language of the validation result messages 

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -locale de

...

The validation engine uses a terminology server to validate codes from large external terminologies such as SNOMED CT, LOINC, RxNorm, etc. By default, the terminology server used is tx.fhir.org, which supports most of these terminologies. If you want to use another terminology server, you can specify one using the -tx parameter:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -tx http://myserver/r3

...

Alternatively, you can run without any terminology support:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -tx n/a

...

To get the validator to flag such issues, invoke it with the parameter -hintAboutNonMustSupport

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -hintAboutNonMustSupport

...

The -extensions parameter controls how extensions are validated by the validator. By default, unknown extensions are prohibited.

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -extension *

This allows all unknown extensions

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -extension http://example/org/

...

By default, the validator will validate a QuestionaireResponse resources against the specified questionnaire resource, if one is specified. The behavior of this can be controlled by the -questionnaire parameter:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -questionnaire none

...

When the validator encounters a code that is not part of an extensible binding, it adds a warning to suggest that the code be reviewed

 java -jar org.hl7.fhir.validatorvalidator_cli.jar [src] -no-extensible-binding-warnings

...

Set the minimum level for validation messages

 java -jar org.hl7.fhir.validator.jarvalidator_cli.jar [src] -level warnings

Possible values: - hints - report all hints, warnings and errors. (same as if not present) - warnings - report all warnings and errors, but not hints - errors - report all errors, but not warnings and hints

...

By default, the validation engine only validates using the FHIR structures and profiles. The publication processes also generate a variety of xml, json and RDF schemas. You can ask the validator to validate against these as well using the native parameter:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -native

...

-txLog filename 

java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -txLog c:\temp\txlog.txt

...

When crumb-trails is set, the validator will create hints against the resources to explain which profiles it has validate the resource against, and why

-crumb-trails

java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\patient.xml -version 3.0 -crumb-trails

Show Validator Internal Times

When show-times is set, the validator will produce a line in the output summarising how long some internal processes took

-show-times

java -jar validator_cli.jar c:\temp\patient.xml -version 3.0 -crumbshow-trailstimes

Validating CDA Documents

The FHIR Validator can validate CDA documents.

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\cda.xml -ig hl7.fhir.cda 

...

The validator can convert between versions of FHIR (r2, r3, and r4). To use the validator to convert versions, provide the following parameters:

 java -jar org.hl7.fhir.validatorvalidator_cli.jar c:\temp\observation.xml -version 3.0 -to-version 4.0 -output c:\temp\observation4.json

...