This wiki has undergone a migration to Confluence found Here
<meta name="googlebot" content="noindex">

Difference between revisions of "FHIR IG publisher templates"

From HL7Wiki
Jump to navigation Jump to search
Line 14: Line 14:
  
 
{|
 
{|
|+ |- package id || desription || documentation || source
+
|+  
|- fhir.template.test || a test template the generates all the kinds of things that can be published || Todo || http://github.com/fhir/test-template  
+
| package id  
|- fhir.template.hl7 || the standard template for HL7 published implementation guides || ? || http://github.com/hl7/fhir-ig-template
+
| desdription
|- fhir.template.hl7-au || the standard template for HL7 Australia published implementation guides || ? || http://github.com/hl7-au/fhir-ig-template
+
| documentation  
|- ihe.template.fhir || the standard template for IHE-published implementation guides || ? |?
+
| source
 +
|-  
 +
||fhir.template.test  
 +
| a test template the generates all the kinds of things that can be published  
 +
| Todo  
 +
| http://github.com/fhir/test-template  
 +
|-  
 +
| fhir.template.hl7  
 +
| the standard template for HL7 published implementation guides  
 +
| ?  
 +
| http://github.com/hl7/fhir-ig-template
 +
|-  
 +
| fhir.template.hl7-au  
 +
| the standard template for HL7 Australia published implementation guides  
 +
| ?  
 +
| http://github.com/hl7-au/fhir-ig-template
 +
|-  
 +
| ihe.template.fhir  
 +
| the standard template for IHE-published implementation guides  
 +
| ?  
 +
| ?
 
|}
 
|}
  

Revision as of 06:26, 17 October 2018

FHIR IG templates are used by the FHIR IG Publishing tool when publishing FHIR Implementation Guides. The templates control:

  • the look and feel of the published IG
  • the way the resources are expressed as pages
  • how users navigate around the pages

From the point of view of an IG Author, the IG template consists of a package they reference, and documentation that describes how the author writes their own narrative and fits that into the pages described by the template.

Known IG templates

To use a template, you specify the 'template' parameter in the IG. You can nominate the official packageId for a template (package ids in the HL7 namespace are assigned by the FHIR product director, and other wise you can make up your own)

List of known IGs:

package id desdription documentation source
fhir.template.test a test template the generates all the kinds of things that can be published Todo http://github.com/fhir/test-template
fhir.template.hl7 the standard template for HL7 published implementation guides ? http://github.com/hl7/fhir-ig-template
fhir.template.hl7-au the standard template for HL7 Australia published implementation guides ? http://github.com/hl7-au/fhir-ig-template
ihe.template.fhir the standard template for IHE-published implementation guides ? ?

Note to template authors: you can add your template to this table, as a url + documentation, but only the FHIR product director can make a particular template trusted (see below).

Authoring IG templates

The information below is for authors of templates and is highly technical. It should only be used by template authors.

A template contains 3 kinds of artifacts:

  • configuration files that describe how resources are rendered into HTML
  • active scripts that generate content as part of the build process
  • jekyll templates / include files / html files

In addition to these artifacts which are for the IG publisher, the template must contain documentation that describes how an author adds pages and narrative content to the Implementation guide.

Template Resolution

When accessing a template by its URL:

  • if the URL specifies a github.com location, then the IG publisher will assume that the template is a github repository and download it directly
  • if the URL is a file location, then the IG publisher will assume that template is local, and copy all the files
  • else it will look for [url]\package.tgz, or [url]\package.zip

When copying the files, all the files will be placed into a \template directory alongside the \temp directory, except for any files in a folder named "jekyll" in the template, which will be copied into the \temp directory - e.g. provided to Jekyll as published content directly

File layout of a Template

The template lives in a github location somewhere. There are 2 important folders in the template layout:

  • package - must contain a file package.json, with contents as below.
  • template - contains the actual contents of the template that are distributed

Any other folders can exist and contain whatever the author wants- they are ignored by the FHIR IG publisher tooling.

The contents of the \template folder will be copied into \template in the IG that uses the template while it is built. The template folder must contain:

  • a config.json file (see below)
  • a jekyll folder (copied into temp for jekyll to process)

The template folder can contain whatever else is needed for processing the template of the scripts

package.json

Use this as a template:

 {
  "name": "[package-id]",
  "version": "[ver]",
  "type": "fhir.template",
  "license": "[license]",
  "description": "[description]",
  "author": "[url]"
}

Notes:

  • [package-id] must be chosen in association with the FHIR product director
  • [ver] is under manual control of the author. Use semver
  • [license] - license of author's choice. Use CC0-1.0 for HL7 published templates
  • [description] - whatever
  • [url] - your org/personal website. use http://hl7.org/fhir for HL7 authored templates

config.json

    • note: when the config.json section is replaced by the new Implementation Guide resource, this section will change**

This is a json file, which has the same format as the config file documented in the IG Publisher Documentation. The contents of this file are merged with the json file for the IG. Entries in the template json file overwrite the entries in the IG json file. The principal use of this file is to specify all the templates for the different content.

In addition, the template json file has the following new entries

  • still to be documented


Active Scripts

A template can contain 2 ant build scripts that allow the template to inspect the content of the IG and generate additional content. These will be run at selected points in the build process:

  • before-generate.xml - run as soon as all the content is loaded and the resource outputs are generated, but before any html fragments are generated - this is provided so that the template can generate template-config.xml/json and/or to perform pre-processing on resource content (see below)
  • after-generate.xml - run after all the generation is complete, before Jekyll is run: this the primary template active point to generate whatever additional content the template wants the output files/fragments to contain

The ant scripts can do whatever is desired, with the following limitations:

  • The build file should be able to run offline (e.g. only depend on content in the template and from the IG publisher)
  • whatever the script does should run ok on windows, linux, and OSX
  • The IG auto-publisher will only accept templates that include active scripts if they are in the list of standard templates above.

Note: if you run the IGPublisher jar with the parameter -debug, it will stop and wait for a prompt at the script execution point to allow template authors to inspect the content of the temp folder