https://github.com/drew-daniels/fhir-schema-export
CLI to fetch JSON Schema for various FHIR resources and convert it into a variety of tabular formats
https://github.com/drew-daniels/fhir-schema-export
csv export fhir hl7 json markdown schema tsv typescript
Last synced: 6 months ago
JSON representation
CLI to fetch JSON Schema for various FHIR resources and convert it into a variety of tabular formats
- Host: GitHub
- URL: https://github.com/drew-daniels/fhir-schema-export
- Owner: Drew-Daniels
- License: gpl-3.0
- Created: 2025-04-22T13:50:31.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-04-22T14:27:53.000Z (6 months ago)
- Last Synced: 2025-04-22T14:50:07.737Z (6 months ago)
- Topics: csv, export, fhir, hl7, json, markdown, schema, tsv, typescript
- Language: TypeScript
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
FHIR Schema Export
=================CLI to fetch JSON Schema for various FHIR resources and convert it into a Markdown Table format
[](https://oclif.io)
[](https://npmjs.org/package/fhir-schema-export)
[](https://npmjs.org/package/fhir-schema-export)* [Usage](#usage)
* [Commands](#commands)
* [Configuration](#configuration)
* [Roadmap](#roadmap)# Usage
```sh-session
$ npm install -g fhir-schema-export
$ fsx COMMAND
running command...
$ fsx (--version)
fhir-schema-export/0.2.0 darwin-arm64 node-v22.14.0
$ fsx --help [COMMAND]
USAGE
$ fsx COMMAND
...
```# Commands
* [`fsx`](#fsx)
## `fsx`
Update installed plugins.
```
USAGE
$ fsx [-h] [-v]FLAGS
-h, --help Show CLI help.
-v, --verboseDESCRIPTION
Update installed plugins.
```# Configuration
You can modify the default configuration of `fhir-schema-export` by creating a configuration file in any of the following locations:
- `~/.fsxrc.mjs`
- `~/fsxrc.config.mjs`
- `~/.config/fsxrc.mjs`The default configuration is:
```javascript
{
// FHIR release that should be used to pull resource schema from
fhirRelease: "R4",
// Custom fields that should be included within the output
// Each property in 'fields' corresponds to a column that will be included in the output
// The 'label' value determines the column name
// The 'value' method determines the value that will be displayed within that column for a given schema element
fields: {
id: {
label: 'ID',
value(el) {
return el.id
}
},
flags: {
label: 'Flags',
value({ isSummary, isModifier }) {
const results = []
if (isModifier) {
results.push("?!")
}if (isSummary) {
results.push("Σ")
}return results.join(" ")
}
},
card: {
label: 'Card',
value({ max, min }) {
return formatResourceCardinality(min, max)
},
},
short: {
label: 'Short',
value(el) {
return format(el.short)
}
},
definition: {
label: 'Definition',
value(el) {
return format(el.definition)
}
},
type: {
label: 'Type',
value(el) {
return formatResourceType(el.type)
}
},
binding: {
label: "Binding",
value(el) {
if (el.binding) {
const extensions = el.binding.extension || []
const binding = extensions.find((ext) => ext.valueString)?.valueString
const bindingStrength = el.binding.strength
return `${binding}(${bindingStrength})`
}return ''
}
}
}
}
```# Roadmap
- [ ] Figure out why `--version` flag is unrecognized
- Potentially has something to do with using the `single` mode for oclif binary
- [ ] Look into potentially using one of these codegen library to generate FHIR resource schema:
- https://github.com/microsoft/fhir-codegen
- https://github.com/fhir-schema/fhir-schema-codegen
- [ ] Remove "Supported Resources" logic and just add better error handling so we don't have to manage "supported" resources when they change
- [ ] Enable partial configuration
- [ ] Add configuration validation
- [ ] Unit tests
- [ ] Publish NPM packages
- [ ] Add `code/binding` field
- [ ] Enable users to export to other formats:
- `xlsx`
- [ ] Enable users to write content to files:
- `csv`
- `tsv`
- `xlsx`
- [ ] Figure out how to handle fields that have multiple `code` values
- Ex.) User wants to specify 'fields' but wants to use the default 'fhirRelease' config value
- [ ] Add `verbose` flag