Difference between revisions of "Proposed new FHIR IG build Process"
Line 3: | Line 3: | ||
= Summary = | = Summary = | ||
+ | |||
+ | Building an IG is a 3 part process: | ||
+ | * Defining the resources that underpin the Implementation Guide resources (Implementation Guide, Conformance Resources, Knowledge statements, examples) | ||
+ | * Building the publishing process that will publish it (linked to where it will be published) | ||
+ | * Developing the structure and the narrative content that turns the resources into a useful implementation guide | ||
+ | |||
+ | The FHIR team provide a IG Publishing tool that takes the implementation guide resources and converts them to a set of 3 different types of files: | ||
+ | * generated resources ready for inclusion into the published guide (xml, json, ttl formats) | ||
+ | * a set of fragments ready to include in generated html files | ||
+ | * 4 standard zip files: definitions.zip, xml.zip, json.zip, and ttl.zip - these are used by implementers for various purposes, so should be included in the final published version | ||
+ | |||
+ | = Using the IG Publisher = | ||
The publishing process is a 2 step process: | The publishing process is a 2 step process: | ||
# run the FHIR IG Publisher to validate all the resources & generate fragments | # run the FHIR IG Publisher to validate all the resources & generate fragments | ||
# run a web site build tool to generate the final IG | # run a web site build tool to generate the final IG | ||
+ | |||
+ | Supported tools for the second part of the process: | ||
+ | * Jekyll | ||
+ | |||
+ | To add tools to this list, discuss your tool of choice with Grahame Grieve | ||
= FHIR IG Publisher = | = FHIR IG Publisher = | ||
− | This is a java jar | + | This is a java jar called org.hl7.fhir.igpublisher.jar. You can get it from |
+ | the downloads for the version of FHIR you are using, or - if you build locally - from | ||
+ | your own publish directory. The jar includes everything from the spec | ||
+ | that is required to generate the implementation guide. Make sure you use the | ||
+ | correct version of the IG publisher for your guide. | ||
− | + | The jar can be run from the command line, or hosted in a process. This documentation | |
− | * | + | concerns the command line version. If you're hosting it, look at the class org.hl7.fhir.igtools.Publisher for guidance. |
− | ** | + | |
− | * | + | Run the IG Publisher like this: |
− | + | ||
+ | java -jar org.hl7.fhir.igpublisher.jar -ig [source] -tool [tool] | ||
+ | -out [folder] -spec [path] -tx [url] -watch"); | ||
+ | |||
+ | parameters: | ||
+ | * -ig: a path or a url where the implementation guide control file is found. see below for Documentation of that format | ||
+ | * -tool: The tool that will be used for the second step. Choices, see above. Implications, see below | ||
+ | * -out: a local folder where the output from the IG publisher will be generated | ||
+ | * -spec: the location of the FHIR specification relative to the guide (can be an absolute URL, or relative if the guide will be published on the FHIR site) | ||
+ | * -tx: (optional) Address to use for terminology server (default is http://fhir3.healthintersections.com.au) | ||
+ | * -watch (optional): if this is present, the publisher will not terminate; instead, it will stay running, an watch for changes to the IG or its contents and re-run when it sees changes | ||
once running, it: | once running, it: | ||
Line 23: | Line 54: | ||
* reads the IG, and loads all the resources in the IG | * reads the IG, and loads all the resources in the IG | ||
* processes code systems, value sets, structure definitions, structure maps | * processes code systems, value sets, structure definitions, structure maps | ||
− | * validates the all resources in the IG | + | * validates the all resources in the IG and produces an HTML file with any errors encountered |
− | |||
* for each resource in the IG, generate a set of files - renderings of the artifact for possible inclusion in the published IG | * for each resource in the IG, generate a set of files - renderings of the artifact for possible inclusion in the published IG | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
= Control file = | = Control file = | ||
− | When the IG publisher is executed, it is pointed at a json file that contains publishing information about the Implementation Guide. | + | When the IG publisher is executed, it is pointed at a json file that contains publishing information about the Implementation Guide. |
+ | This is a json file in the same directory as the implementation guide resource, with the same [name].json, with this structure: | ||
{ | { | ||
− | + | "source": "daf.xml", | |
− | "source" : " | + | "dependencies": { |
− | + | "_documentation": "not done yet" | |
− | + | }, | |
− | // | + | "canonicalBase": "http://hl7.org/fhir", |
− | + | "defaults": { | |
− | + | "_documentation": "this object contains the default publishing policy for different types. Anything not mentioned defaults to true", | |
− | + | "Any": { | |
− | + | "_documentation": "fragment options - see below | |
− | + | }, | |
− | + | "[Type]": { | |
− | + | "_documentation": "fragment options - see below | |
− | + | } | |
− | + | }, | |
− | + | "resources": { | |
− | + | "[Type]/[id]": { | |
− | + | "source" : "[optional source file]", | |
− | + | "base": "[destination page for things referring to this resource", | |
− | + | "defns": "[destination page, for structure definitions]", | |
− | + | "_documentation": "fragment options - see below | |
− | + | } | |
− | + | } | |
− | |||
− | |||
} | } | ||
− | This file must be maintained by the editor of the implementation guide | + | This file must be maintained by the editor of the implementation guide. The IG resource must use sourceReference references by id. The |
+ | ids are resolved to a local file by this control file. if there is no "source" property, the files will be assumed to be in the same | ||
+ | directory as the ig, with the name [type]-[id].xml/json, or just [id].xml/json | ||
− | = | + | == Fragment Options == |
− | + | When deciding whether to produce a particular kind of fragment, the IG Publisher will | |
− | + | look for a property of type boolean with the name given below. It will look in the following | |
− | + | places, in order: | |
− | + | * on the resource entry for the resource in question | |
− | + | * on the defaults entry for the resource type in question | |
− | * | + | * on the defaults entry for "Any" |
− | * | ||
− | |||
− | |||
− | + | if it doesn't find anything, it will produce the fragment. | |
− | |||
− | |||
− | |||
− | + | == Fragment Codes == | |
− | |||
− | + | * xml: XML version of the resource (all resource types) | |
− | * | + | * json: JSON version of the resource (all resource types) |
− | ** | + | * ttl: Turtle version of the resource (all resource types) |
+ | * xml-html: html representation of XML version of the resource (all resource types) | ||
+ | * json-html: html representation of JSON version of the resource (all resource types) | ||
+ | * ttl-html: html representation of Turtle version of the resource (all resource types) | ||
+ | * html: narrative of resource as html | ||
+ | * summary: An html summary for the resource (all conformance resources) | ||
+ | * content: An HTML representation of the content in resource (code system, concept map, structure map) | ||
+ | * xref: A list of all the places where the resource is used (all conformance resources) | ||
+ | * cld: An HTML representation of the content in resource (value set) | ||
+ | * expansion: The expansion of the value set (Value set) | ||
+ | * shex: ShEx statement for the structure (Structure Definition) | ||
+ | * sch: schematron statement for the structure (Structure Definition) | ||
+ | * json-schema: JSON Schema statement for the structure (Structure Definition) | ||
+ | * header: Description of the identification of the structure (Structure Definition) | ||
+ | * diff: Logical Table of the diff (Structure Definition) | ||
+ | * snapshot: Logical Table of the snapshot (Structure Definition) | ||
+ | * template-xml: XML template for the snapshot (Structure Definition) | ||
+ | * template-json: JSON template for the snapshot (Structure Definition) | ||
+ | * template-ttl: Turtle template for the snapshot (Structure Definition) | ||
+ | * uml: UML diagram for the structure (Structure Definition) | ||
+ | * tx: Terminology Notes for the structure (Structure Definition) | ||
+ | * inv: invariant summary for the structure (Structure Definition) | ||
+ | * dict: Detailed Element Definitions (Structure Definition) | ||
+ | * maps: Presentation of the mappings (Structure Definition) | ||
− | == | + | = Build = |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | = | + | == Jekyll == |
− | + | If you specify Jekyll as the tool, the the following outputs are created | |
− | + | X (X is the nominated output directory) - untouched | |
+ | X\generation - the validation file, and the all the generated qa pages (one for each fragment, so you can see what the fragments are supposed to look like) | ||
+ | X\html - the content for the final IG. This is the Jekyll root directory | ||
+ | X\html\_includes - all the fragments, so you can {%include%} them | ||
+ | X\html\_data - a data file fhir.json with additional properties so you can access them when templating |
Revision as of 11:43, 2 June 2016
This is some notes about of the proposed new FHIR build process for publishing implementation guides
Contents
Summary
Building an IG is a 3 part process:
- Defining the resources that underpin the Implementation Guide resources (Implementation Guide, Conformance Resources, Knowledge statements, examples)
- Building the publishing process that will publish it (linked to where it will be published)
- Developing the structure and the narrative content that turns the resources into a useful implementation guide
The FHIR team provide a IG Publishing tool that takes the implementation guide resources and converts them to a set of 3 different types of files:
- generated resources ready for inclusion into the published guide (xml, json, ttl formats)
- a set of fragments ready to include in generated html files
- 4 standard zip files: definitions.zip, xml.zip, json.zip, and ttl.zip - these are used by implementers for various purposes, so should be included in the final published version
Using the IG Publisher
The publishing process is a 2 step process:
- run the FHIR IG Publisher to validate all the resources & generate fragments
- run a web site build tool to generate the final IG
Supported tools for the second part of the process:
- Jekyll
To add tools to this list, discuss your tool of choice with Grahame Grieve
FHIR IG Publisher
This is a java jar called org.hl7.fhir.igpublisher.jar. You can get it from the downloads for the version of FHIR you are using, or - if you build locally - from your own publish directory. The jar includes everything from the spec that is required to generate the implementation guide. Make sure you use the correct version of the IG publisher for your guide.
The jar can be run from the command line, or hosted in a process. This documentation concerns the command line version. If you're hosting it, look at the class org.hl7.fhir.igtools.Publisher for guidance.
Run the IG Publisher like this:
java -jar org.hl7.fhir.igpublisher.jar -ig [source] -tool [tool] -out [folder] -spec [path] -tx [url] -watch");
parameters:
- -ig: a path or a url where the implementation guide control file is found. see below for Documentation of that format
- -tool: The tool that will be used for the second step. Choices, see above. Implications, see below
- -out: a local folder where the output from the IG publisher will be generated
- -spec: the location of the FHIR specification relative to the guide (can be an absolute URL, or relative if the guide will be published on the FHIR site)
- -tx: (optional) Address to use for terminology server (default is http://fhir3.healthintersections.com.au)
- -watch (optional): if this is present, the publisher will not terminate; instead, it will stay running, an watch for changes to the IG or its contents and re-run when it sees changes
once running, it:
- loads all resources in the validation.zip
- reads the control file
- reads the IG, and loads all the resources in the IG
- processes code systems, value sets, structure definitions, structure maps
- validates the all resources in the IG and produces an HTML file with any errors encountered
- for each resource in the IG, generate a set of files - renderings of the artifact for possible inclusion in the published IG
Control file
When the IG publisher is executed, it is pointed at a json file that contains publishing information about the Implementation Guide. This is a json file in the same directory as the implementation guide resource, with the same [name].json, with this structure:
{ "source": "daf.xml", "dependencies": { "_documentation": "not done yet" }, "canonicalBase": "http://hl7.org/fhir", "defaults": { "_documentation": "this object contains the default publishing policy for different types. Anything not mentioned defaults to true", "Any": { "_documentation": "fragment options - see below }, "[Type]": { "_documentation": "fragment options - see below } }, "resources": { "[Type]/[id]": { "source" : "[optional source file]",
"base": "[destination page for things referring to this resource", "defns": "[destination page, for structure definitions]",
"_documentation": "fragment options - see below } } }
This file must be maintained by the editor of the implementation guide. The IG resource must use sourceReference references by id. The ids are resolved to a local file by this control file. if there is no "source" property, the files will be assumed to be in the same directory as the ig, with the name [type]-[id].xml/json, or just [id].xml/json
Fragment Options
When deciding whether to produce a particular kind of fragment, the IG Publisher will look for a property of type boolean with the name given below. It will look in the following places, in order:
- on the resource entry for the resource in question
- on the defaults entry for the resource type in question
- on the defaults entry for "Any"
if it doesn't find anything, it will produce the fragment.
Fragment Codes
- xml: XML version of the resource (all resource types)
- json: JSON version of the resource (all resource types)
- ttl: Turtle version of the resource (all resource types)
- xml-html: html representation of XML version of the resource (all resource types)
- json-html: html representation of JSON version of the resource (all resource types)
- ttl-html: html representation of Turtle version of the resource (all resource types)
- html: narrative of resource as html
- summary: An html summary for the resource (all conformance resources)
- content: An HTML representation of the content in resource (code system, concept map, structure map)
- xref: A list of all the places where the resource is used (all conformance resources)
- cld: An HTML representation of the content in resource (value set)
- expansion: The expansion of the value set (Value set)
- shex: ShEx statement for the structure (Structure Definition)
- sch: schematron statement for the structure (Structure Definition)
- json-schema: JSON Schema statement for the structure (Structure Definition)
- header: Description of the identification of the structure (Structure Definition)
- diff: Logical Table of the diff (Structure Definition)
- snapshot: Logical Table of the snapshot (Structure Definition)
- template-xml: XML template for the snapshot (Structure Definition)
- template-json: JSON template for the snapshot (Structure Definition)
- template-ttl: Turtle template for the snapshot (Structure Definition)
- uml: UML diagram for the structure (Structure Definition)
- tx: Terminology Notes for the structure (Structure Definition)
- inv: invariant summary for the structure (Structure Definition)
- dict: Detailed Element Definitions (Structure Definition)
- maps: Presentation of the mappings (Structure Definition)
Build
Jekyll
If you specify Jekyll as the tool, the the following outputs are created
X (X is the nominated output directory) - untouched X\generation - the validation file, and the all the generated qa pages (one for each fragment, so you can see what the fragments are supposed to look like) X\html - the content for the final IG. This is the Jekyll root directory X\html\_includes - all the fragments, so you can {%include%} them X\html\_data - a data file fhir.json with additional properties so you can access them when templating