This wiki has undergone a migration to Confluence found Here

Difference between revisions of "Using the FHIR Validator to transform content"

From HL7Wiki
Jump to navigation Jump to search
Line 16: Line 16:
  
 
+ you need to tell the engine where to find all the relevant logical models, mapping libraries, etc.
 
+ you need to tell the engine where to find all the relevant logical models, mapping libraries, etc.
 +
 +
= Choosing what to transform =
 +
 +
There must be at just one source param, which is not a named parameter. All other parameters are 'named parameters' - e.g. -name value. Any parameter preceded by a recognised name is interpreted as a source parameter
 +
 +
The source parameter can contain either:
 +
 +
* a URL that returns the resource to validate (authentication is not supported)
 +
* a filename (relative to the current directory, or absolute)
 +
* a directory that contains resources to validate (all files are validated if they are recognised as resources)
 +
* a pattern: a directory followed by a filename with an embedded asterisk.  E.g. foo*-examples.xml or someresource.*, etc
 +
 +
In the case of a directory or a pattern, it is an error if there is more than one matching file.
 +
 +
Exammple:
 +
 +
  java -jar org.hl7.fhir.validator.jar -transform /tmp/resource.json
 +
 +
or
 +
 +
  java -jar org.hl7.fhir.validator.jar -transform c:\temp\patient.xml
 +
 +
= Choosing what to produce =
 +
 +
= Specifying the map to start with =
 +
 +
= choosing where to save the log =
 +
 +
= Specifying libraries =
 +
 +
The transform engine will need to load your mapping libraries, logical models, and the relevant FHIR version.

Revision as of 22:03, 22 October 2018

This page describes how to use the validator to transform content from one format to another using the [FHIR Mapping Language]. To use the validator for validation, see Using the FHIR Validator

Running the validator

To use the validator, download the jar from http://build.fhir.org/downloads.html. Specifically, download the official FHIR validator at http://build.fhir.org/validator.zip Note that you always use the current validator from the build, irrespective of what transforms you are running.. You need a current version of java to run the validator:

 java -jar org.hl7.fhir.validator.jar -transform  [params]

The params control how the transfomration occurs, and are documented here.

In general, in order to perform the transform, you need to specify:

  • what to transform
  • the map to use to transform it
  • where to put the tranform

+ you need to tell the engine where to find all the relevant logical models, mapping libraries, etc.

Choosing what to transform

There must be at just one source param, which is not a named parameter. All other parameters are 'named parameters' - e.g. -name value. Any parameter preceded by a recognised name is interpreted as a source parameter

The source parameter can contain either:

  • a URL that returns the resource to validate (authentication is not supported)
  • a filename (relative to the current directory, or absolute)
  • a directory that contains resources to validate (all files are validated if they are recognised as resources)
  • a pattern: a directory followed by a filename with an embedded asterisk. E.g. foo*-examples.xml or someresource.*, etc

In the case of a directory or a pattern, it is an error if there is more than one matching file.

Exammple:

 java -jar org.hl7.fhir.validator.jar -transform /tmp/resource.json

or

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

Choosing what to produce

Specifying the map to start with

choosing where to save the log

Specifying libraries

The transform engine will need to load your mapping libraries, logical models, and the relevant FHIR version.