FHIR Guide to Authoring Types
This is the technical documentation that describes what you do to author a shared type that will be part of the FHIR specification. Shared types are useful for defining structures that are used across multiple resources, but should only be defined when there is a clear benefit to doing so that offsets the additional maintenance and complexity of a base type.
Note: before attempting to author shared types, you MUST be able to successfully run the FHIR build process. You must also sign up to the FHIR Committers Skype chat (contact an FMG member or other known FHIR developer to get added).
Background
FHIR Shared types are defined similarly to FHIR resources, and you should be familiar with the process for authoring resources before attempting to author shared types.
Creating a new shared type is only done by the FHIR project team once a new shared type has been proposed and accepted. This section documents the process that the project team follows. paths are relative to the source directory.
Note: talk to Grahame before following this process. This documentation was added by Bryn (thanks!) after following the process, but there's variations to it to plan.
- 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 . . .)
- add the base description of the type to the "source/datatypes" folder
- copy /template/template-spreadsheet.xml to /source/datatypes/[name].xml
- open it and replace "[ResourceOrDataTypeName]" in the first column of the Data Elements tab with [Name]
- change the value of the Type column to "Type" instead of "DomainResource"
- copy /template/template-html.xml to /source/datatypes/[name]-notes.xml and /source/datatypes/[name]-introduction.xml
- copy /template/template-example.xml /source/datatypes/[name]-example.xml
- Add the source html pages for the type to the "source" folder
- See elementdefinition or modulemetadata for examples
- [name].html
- [name]-definitions.html
- [name]-mappings.html
- [name]-examples.html
- Change the content and processing tags in these pages as appropriate
- ElementDefinition uses "edheader", ModuleMetadata uses "mmheader"
- Tags are processed in PageProcessor:
- tools/java/org.hl7.fhir.tools.core/src/org/hl7/fhir/tools/publisher/PageProcessor.java
- See elementdefinition or modulemetadata for examples
- Add the type to /fhir.ini in the following sections:
- add [name] to the [shared] section
- add [name]=[name] to the [type-pages] section
- add [name]=committee to workgroups section
- add [Name]=tla the tlas section
- edit /heirarchy.xml and add your page under the correct place within the site's navigation
- Add the type pages to /publish.ini in the [pages] section:
- [name].html=
- [name]-definitions.html=
- [name]-mappings.html=
- [name]-examples.html=
- test and make sure the build completes without errors
- commit all changes to SVN
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.