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

Difference between revisions of "FHIR Guide to Authoring Resources"

From HL7Wiki
Jump to navigation Jump to search
(37 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
{{FHIR Discussion Page}}
 +
[[Category:Active FHIR Discussion]]
 +
 
This is the technical documentation that describes what you do to author a resource that will be part of the FHIR specification. There is a also a [[FHIR Guide to Designing Resources|Design Guide]] that addresses how resources should be designed.
 
This is the technical documentation that describes what you do to author a resource that will be part of the FHIR specification. There is a also a [[FHIR Guide to Designing Resources|Design Guide]] that addresses how resources should be designed.
  
Note: before attempting to author resources, you must be able to successfully [[FHIR Build Process|run the FHIR build process]].
+
<b>Note: before attempting to author resources, you MUST be able to successfully [[FHIR Build Process|run the FHIR build process]]. You must also sign up to the FHIR Committers Zulip chat at https://chat.fhir.org/#narrow/stream/committers
  
 
== Background ==
 
== Background ==
  
All FHIR resources have both a lower camel case name [name], and an upper camel-case name [Name]. Each resource has a sub-directory [name] in the source folder of the FHIR svn hierarchy, which contains all the files related to the resource. The build process looks for the following files:
+
All FHIR resources have both a lower case name [name], and a Pascal-case name [Name]. For example, for the StructureDefinition resource, the lower case name is structuredefinition and the Pascal-case name is StructureDefinition. Each resource has a sub-directory [name] in the source folder of the FHIR git repository, which contains all the files related to the resource. The build process looks for the following files:
  
 
* an excel spreadsheet [name]-spreadsheet.xml that defines the content and behavior of the resource
 
* an excel spreadsheet [name]-spreadsheet.xml that defines the content and behavior of the resource
Line 14: Line 17:
 
* one or more [name]-(whatever)-example.xml which is an example of the resource (refer to [[#Example Elements Tab]] for guidance on naming example files.
 
* one or more [name]-(whatever)-example.xml which is an example of the resource (refer to [[#Example Elements Tab]] for guidance on naming example files.
  
Only the first file must exist, though at least one example must exist. Managing examples is discussed further below.  
+
Only the first file must exist, though at least one example must exist. Managing examples is discussed further below.
 
 
==Set-up==
 
 
 
To create or maintain resources, you need access to HL7's SVN environment and permission to edit FHIR resources.  The steps are:
 
# Acquire an SVN client such as TortoiseSVN[http://tortoisesvn.net/downloads.html] or Eclipse
 
# Get an [http://gforge.hl7.org/gf/account/?action=UserAdd|HL7 gForge account]
 
# Get commit privileges for FHIR by contacting one of the FMG co-chairs.  (Let them know your gForge id)
 
# Check out the FHIR project (http://gforge.hl7.org/svn/fhir/trunk) into a local directory of your choice
 
# Ensure you have a current Java SDK installed on your machine (1.6)
 
## Note: A JVM is <b>not</b> sufficient.  You MUST have a Java SDK
 
# Edit the "publish.bat" or "publish.sh" file to point to your SDK. (and please don't commit this file)
 
## Just invoking "Java" based on your path will run the JVM rather than the SDK, as installing the SDK installs a JVM too
 
# Download and install GraphViz[http://www.graphviz.org/Download.php]
 
  
 
==Creating a new resource==
 
==Creating a new resource==
Line 33: Line 23:
 
Creating a new resource is only done by the FHIR project team once a new resource has been proposed and accepted. This section documents the process that the project team follows. paths are relative to the source directory.
 
Creating a new resource is only done by the FHIR project team once a new resource has been proposed and accepted. This section documents the process that the project team follows. paths are relative to the source directory.
  
# test and make sure your local copy of the build process completes without errors (so that if something breaks, you can be condident it's your fault . . .)
+
# test and make sure your local copy of the build process completes without errors (so that if something breaks, you can be confident it's your fault . . .)
 
# create the directory [name] in the source directory
 
# create the directory [name] in the source directory
# copy /template/template-spreadsheeet.xml to /[name]/[name]-spreadsheet.xml (and open it, and replace "Template" in the first column of the Data Elements tab with [Name])
+
# copy templates/template-spreadsheet.xml to [name]/[name]-spreadsheet.xml
# copy /template/template-html.xml to /[name]/[name]-notes.xml and /[name]/[name]-introduction.xml
+
## open it and replace "[ResourceOrDataTypeName]" in the first column of the Data Elements tab with [Name])
# copy /template/template-example.xml /[name]/[name]-example.xml
+
## select an appropriate w5 category (e.g. clinical.general) (see source/w5.ini for a list of categories)
# add the new directory and its files to SVN
+
# copy templates/template-notes.xml to [name]/[name]-notes.xml
# edit /fhir.ini
+
# copy templates/template-introduction.xml to [name]/[name]-introduction.xml
 +
# copy templates/template-example.xml [name]/[name]-example.xml
 +
# add the new directory and its files to git
 +
# edit fhir.ini
 
## add [name]=[Name] to the [resources] section
 
## add [name]=[Name] to the [resources] section
## add [name]={desc} to the [status] section. desc is agreed as part of the resource proposal
+
## add [name]=committee to workgroups section
# for some special resources, you may need to register the resource in /navigation.xml. But not for normal resources
+
## add [name]=0 to fmm section
 +
## add [Name]=tla the tlas section
 +
# edit heirarchy.xml and add your page under the correct place within the site's navigation
 +
# open compartments.xml with Excel and specify which search parameters can be used to place the resource in a Patient or Practitioner compartment (or leave empty if N/A)
 +
# if your resource has an element named "status", open status-codes.xml with Excel and add the appropriate mappings to the status. Use other resources in the same category (definition, request, event) as a pattern for the mappings.
 +
# add your resource to resourcelist.html and /resourceguide.html (both in the right category and under the right caption letter)
 +
# add your resource as appropriate in source/administration-module.html, source/clinicalreasoning-module.html, source/clinicalsummary-module.html, source/conformance-module.html, source/diagnostics-module.html, source/financial-module.html, source/foundation-module.html, source/implsupport-module.html, source/medication-module.html, source/ontology-module.html, source/secpriv-module.html, source/terminology-module.html, and/or source/workflow-module.html
 +
# add a translation for your resources name to implementations/translations.xml
 +
# edit the example to fill out the [Name] on the base node and add a <id value="xxx"/> where xxx is what you're going to call the example (usually "example")
 
# test and make sure the build completes without errors
 
# test and make sure the build completes without errors
# commit all changes to SVN
+
# commit all changes to a git branch, push to GitHub, and create a Pull Request (see https://github.com/hl7/fhir/wiki/Get-Started-with-FHIR-on-GitHub]).
 
 
== Excel Spreadsheet ==
 
 
 
The Excel spreadsheet contains the main logical definitions of the resource. In order to support version control, and other forms of text processing, the spreadsheet is stored as an XML document. In Excel, this format is chosen by saving as an XML Spreadsheet 2003. Any other software that can edit this format (i.e. OpenOffice) can also be used.  It's even possible to use a text editor, though this is not recommended. (Note: the project team is not committed to Excel. Alternatives can be considered, as long as the same logical content can be defined).
 
 
 
The Excel spreadsheet contains the following tabs:
 
* Data Elements - defines the actual contents of the resource
 
* Invariants - documents additional rules about the resource such as co-occurrence constraints
 
* Events - defined messaging events for the resource
 
* Search - defined search parameters for the restful interface
 
* Examples - define multiple examples for the resource
 
* Bindings - vocabulary bindings for the resource contents
 
 
 
The order of the tabs is not important, and other tabs can be defined. Except as documented below, other tabs are ignored. In addition, for every page, additional columns can be defined at the discretion of the editor; they will be ignored by the build process. Additional rows other than those containing the defined contents cannot be added.
 
 
 
=== Data Elements Tab ===
 
 
 
=== Examples Tab ===
 
 
 
=== Bindings Tab ===
 
The Binding tab contains the definition of the Bindings as mentioned in the definition of the data elements. The Binding column in the Data Elements Tab refers to the Binding Name.
 
 
 
This tab contains the following columns:
 
* "Binding Name", a string
 
* "Definition", a string
 
* "Binding", a choice. Allowed values are:
 
** (empty) or "unbound"
 
** "code list"
 
** "special"
 
** "reference"
 
** "value set"
 
* "Binding Strength", a choice. Allowed values are:
 
** (emtpy) - Unstated
 
** "required"
 
** "preferred"
 
** "suggested"
 
* "Extensibility", a choice. Allowed values are:
 
** (empty) or "complete"
 
** "extensible"
 
* "Reference", a string
 
* "Description", a string
 
  
In case the Binding is of type "code list", the column "Reference" must contain the name of another tab containing the valueset for this binding, prefixed by '#'. This tab may contain the following columns:
+
== Editing a FHIR resource==
* "Code", a string.
+
Instructions for how to make use of the FHIR resource spreadsheet can be found [[FHIR Spreadsheet Authoring | here]].  Instructions on using the notes and introduction HTML pages are embedded as comments within the XHTML templates. If you run into issues, ask a question on the FHIR Committers list.
* "Display", a string.
 
* "System", a string.
 
* "Definition", a string.
 
* "Comment", a string
 

Revision as of 22:16, 26 September 2018

This is the technical documentation that describes what you do to author a resource that will be part of the FHIR specification. There is a also a Design Guide that addresses how resources should be designed.

Note: before attempting to author resources, you MUST be able to successfully run the FHIR build process. You must also sign up to the FHIR Committers Zulip chat at https://chat.fhir.org/#narrow/stream/committers

Background

All FHIR resources have both a lower case name [name], and a Pascal-case name [Name]. For example, for the StructureDefinition resource, the lower case name is structuredefinition and the Pascal-case name is StructureDefinition. Each resource has a sub-directory [name] in the source folder of the FHIR git repository, which contains all the files related to the resource. The build process looks for the following files:

  • an excel spreadsheet [name]-spreadsheet.xml that defines the content and behavior of the resource
  • several xhtml files that allow additional text documentation to be added for the resource
    • [name]-notes.xml - text documentation that goes below the formal resource definition on the resource page
    • [name]-introduction.xml - text documentation that goes above the formal resource definition on the resource page
    • others yet to be documented
  • one or more [name]-(whatever)-example.xml which is an example of the resource (refer to #Example Elements Tab for guidance on naming example files.

Only the first file must exist, though at least one example must exist. Managing examples is discussed further below.

Creating a new resource

Creating a new resource is only done by the FHIR project team once a new resource has been proposed and accepted. This section documents the process that the project team follows. paths are relative to the source directory.

  1. test and make sure your local copy of the build process completes without errors (so that if something breaks, you can be confident it's your fault . . .)
  2. create the directory [name] in the source directory
  3. copy templates/template-spreadsheet.xml to [name]/[name]-spreadsheet.xml
    1. open it and replace "[ResourceOrDataTypeName]" in the first column of the Data Elements tab with [Name])
    2. select an appropriate w5 category (e.g. clinical.general) (see source/w5.ini for a list of categories)
  4. copy templates/template-notes.xml to [name]/[name]-notes.xml
  5. copy templates/template-introduction.xml to [name]/[name]-introduction.xml
  6. copy templates/template-example.xml [name]/[name]-example.xml
  7. add the new directory and its files to git
  8. edit fhir.ini
    1. add [name]=[Name] to the [resources] section
    2. add [name]=committee to workgroups section
    3. add [name]=0 to fmm section
    4. add [Name]=tla the tlas section
  9. edit heirarchy.xml and add your page under the correct place within the site's navigation
  10. open compartments.xml with Excel and specify which search parameters can be used to place the resource in a Patient or Practitioner compartment (or leave empty if N/A)
  11. if your resource has an element named "status", open status-codes.xml with Excel and add the appropriate mappings to the status. Use other resources in the same category (definition, request, event) as a pattern for the mappings.
  12. add your resource to resourcelist.html and /resourceguide.html (both in the right category and under the right caption letter)
  13. add your resource as appropriate in source/administration-module.html, source/clinicalreasoning-module.html, source/clinicalsummary-module.html, source/conformance-module.html, source/diagnostics-module.html, source/financial-module.html, source/foundation-module.html, source/implsupport-module.html, source/medication-module.html, source/ontology-module.html, source/secpriv-module.html, source/terminology-module.html, and/or source/workflow-module.html
  14. add a translation for your resources name to implementations/translations.xml
  15. edit the example to fill out the [Name] on the base node and add a <id value="xxx"/> where xxx is what you're going to call the example (usually "example")
  16. test and make sure the build completes without errors
  17. commit all changes to a git branch, push to GitHub, and create a Pull Request (see https://github.com/hl7/fhir/wiki/Get-Started-with-FHIR-on-GitHub]).

Editing a FHIR resource

Instructions for how to make use of the FHIR resource spreadsheet can be found here. Instructions on using the notes and introduction HTML pages are embedded as comments within the XHTML templates. If you run into issues, ask a question on the FHIR Committers list.