High-level Architecture
The FSH dialect used by BabelFSH is a compatible subset of the full FSH specification. Defining resources other than CodeSystems (and eventually, ValueSets and ConceptMaps) is not supported by BabelFSH, since SUSHI very nicely fills that gap.
Note as of 2025-01-07: Currently, generating CodeSystems is supported. Preliminary support for ConceptMap generation using a CSV file is also now available. ValueSet generation is not yet supported (the implementation for ConceptMap didn't require VS generation yet)
The BabelFSH architecture is based on a plugin system. Each plugin is responsible for converting a specific type of input file to a set of concepts in a CodeSystem. You manually define the metadata using FSH files (with the filename .babel.fsh for the time being). In the FSH files, you include a specifically-formatted comment as the last name of the file, which tells BabelFSH which plugin to use. The plugin is then responsible for parsing the input file and generating a list of concepts. The fully-converted resource is then output as a FHIR CodeSystem resource in JSON.
Here's a fully functional example for converting a plain-text (roughly CSV-like) file to a FHIR CodeSystem (this example is taken from the alpha-id-se example in the BabelFSH repo:
RuleSet: alphaid-se-metadata
* ^url = "http://fhir.de/CodeSystem/bfarm/alpha-id"
* ^status = #active
* ^experimental = false
* ^copyright = "Die Erstellung erfolgt unter Verwendung der maschinenlesbaren Fassung des Bundesinstituts für Arzneimittel und Medizinprodukte (BfArM)."
* ^property[+].code = #orpha
* ^property[=].type = #string
* ^property[=].description = "Der mit dem Konzept verknüpfte Orphanet-Code"
// further properties omitted for brevity
RuleSet: alphaid-se-babelfsh-2018ff(version, oid, path)
* ^version = "{version}"
* ^identifier[+].system = "urn:ietf:rfc:3986"
* ^identifier[=].value = "urn:oid:{oid}"
* insert alphaid-se-metadata
* ^property[+].code = #icd_10_primaer2
* ^property[=].type = #string
* ^property[=].description = "Der zweite Primär-Code aus der Alpha-ID"
/*^babelfsh
csv
--path='{path}'
--headers=["gueltig", "code", "icd_10", "stern", "ausrufezeichen", "icd_10_2", "orpha", "display"]
--delimiter='|'
--charset=UTF-8
--code-column=code
--display-column='display'
--property-mapping=[{"column":"icd_10","property":"icd_10_primaer"},{"column":"stern","property":"icd_10_stern"},{"column":"ausrufezeichen","property":"icd_10_zusatz"},{"column":"icd_10_2","property":"icd_10_primaer2"},{"column":"orpha","property":"orpha"},{"column":"gueltig","property":"inactive","mapper":{"id":"boolean","arguments":{"true":"0","false":"1"}}}]
^babelfsh*/
CodeSystem: AlphaIdSe
Id: alphaid-se-2024
Title: "Alpha-ID-SE"
Description: "The Alpha-ID is a sequential and stable identification number, which is allocated to each entry in the alphabetical index. It permits the encoding of medical and natural language diagnostic terms."
* insert alphaid-se-babelfsh-2018ff("2024", "1.2.276.0.76.5.538", "./input-files/Alpha-ID/alphaidse2024/icd10gm2024_alphaidse_edvtxt_20230929.txt")The high-level architecture of the application is illustrated below:


Last updated