Skip to main content

FHIR Shorthand Validator

https://img.shields.io/pypi/v/fsh-validator.svg https://img.shields.io/travis/glichtner/fsh-validator.svg Documentation Status Updates

FHIR Shorthand Validator (fsh-validator) unshortens fsh input and validates all defined instances against their profiles.

fsh-validator is an interface to SUSHI and the HL7 FHIR Validator running the following workflow:

  1. Run SUSHI to unshorten fsh files to structure definitions, instances, value sets etc.

  2. Detect all defined profiles, valuesets and instances.

  3. Validate all defined instances using the official HL7 FHIR Validator against their profiles.

For the full documentation see https://fsh-validator.readthedocs.io.

Quickstart

Install the latest fsh-validator:

pip install -U fsh-validator

Or directly from github repository:

pip install -U git+https://github.com/glichtner/fsh-validator

Run fsh-validator in your fsh project path:

$ fsh-validator --all

Parameters

usage: fsh-validator [-h] [--all] [--subdir SUBDIR] [--validator-path PATH_VALIDATOR] [--verbose] [--no-sushi] [--log-path LOG_PATH] [filename [filename ...]]

positional arguments:
  filename              fsh file names (basename only - no path)

optional arguments:
  -h, --help            show this help message and exit
  --all                 if set, all detected profiles will be validated
  --subdir SUBDIR       Specifies the subdirectory (relative to input/fsh/) in which to search for profiles if --all is set
  --validator-path PATH_VALIDATOR
                        path to validator
  --verbose             Be verbose
  --no-sushi            Do not run sushi before validating
  --log-path LOG_PATH   log file path - if supplied, log files will be written

Configuration

fsh-validator reads an optional configuration file .fsh-validator.yml in the base directory of the sushi project. The configuration file currently supports the following parameters:

exclude_code_systems:

A list of code systems to exclude from validation. If an instance contains a code from a code system in this list, the instance will be skipped. This is useful to exclude code systems that are not yet supported by the validator or that may cause problems when validating (e.g. ICD-10-gm) The code systems are specified by their canonical URI. The default is to not exclude any code systems.

exclude_resource_types:

A list of resource types to exclude from validation. If an instance implements a resource of a type in this list, the instance will be skipped. This is useful to exclude resources that are not yet supported by the validator or that may cause problems when validating. The resource types are specified by their canonical name (e.g. “Bundle”). The default is to not exclude any resource types.

Example configuration file:

exclude_code_systems:
    - http://hl7.org/fhir/sid/icd-10-cm
    - http://fhir.de/CodeSystem/bfarm/icd-10-gm

exclude_resource_types:
    - Bundle
    - OperationOutcome

Examples

Example call to validate a *single* profile

$ cd ExampleIG/
$ fsh-validator input/fsh/p-thoracic-drainage.fsh

Example call to validate *all* profiles

The following call validates all profiles in the subdirectory “vaccination/” and writes the results of the validation log files in the directory logs/.

$ cd ExampleIG/
$ fsh-validator --all --subdir vaccination/ --log-path logs/

This is equivalent to calling:

$ fsh-validator input/fsh/vaccination/*.fsh --log-path logs/

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.3.1 (2022-11-30)

  • Fixed validation when profiles are not known from the FHIR package cache

0.3.0 (2022-11-29)

  • Validation speed increased by batch processing of files

0.2.2 (2021-11-10)

  • Fixed processing of bundle resources

  • Fixed processing of profiles that have parent profiles defined in the same project

  • Added possibility to exclude certain types of resources from validation (via .fsh-validator.yml file)

  • Added exclusion of abstract profiles from validation

0.2.1 (2021-11-11)

  • Improved output messages

0.2.0 (2021-11-11)

  • Added possibility to excluding specific code systems from validation

0.1.9 (2021-11-09)

  • Added workaround function for invalid SUSHI outputs (duplicated codings in MII Laboratory Observation Profile)

0.1.8 (2021-11-08)

  • Added support for extensions

0.1.7 (2021-11-05)

  • Added requirements to setup.py

0.1.6 (2021-11-05)

  • Reading FHIR version to use in validator from sushi-config.yaml

0.1.5 (2021-11-03)

  • Fixed validation of questionnaires

0.1.4 (2021-11-02)

  • Fixed instances/profiles regex for aliases

0.1.3 (2021-10-25)

  • Fixed FshPath

0.1.2 (2021-10-25)

  • Added requirements to setup.py

0.1.1 (2021-10-25)

  • Fix python package

0.1.0 (2021-10-25)

  • First release on PyPI.

Metadata

Release files for fsh-validator 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fsh-validator 0.3.5
File Size Uploaded Provenance Actions
fsh-validator-0.3.5.tar.gz 25.6 kB Without provenance Details for fsh-validator-0.3.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fsh-validator 0.3.5
File Interpreter ABI Platform Actions
fsh_validator-0.3.5-py2.py3-none-any.whl Python 2, Python 3 none any Details for fsh_validator-0.3.5-py2.py3-none-any.whl

Total release size: 44.8 kB

Release files / fsh-validator-0.3.5.tar.gz

Download URL fsh-validator-0.3.5.tar.gz
Size 25.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5b282a116379db23db3bdc5f1038c57168478c09736c984ee6367c602b2e3ae8
BLAKE2b-256 checksum
How to use checksums
4053d4a9bb10a6c28d69b0a6d2f2cdb2b9ff009d49f6ac29f5421abca04c2565
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / fsh_validator-0.3.5-py2.py3-none-any.whl

Download URL fsh_validator-0.3.5-py2.py3-none-any.whl
Size 19.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2a6f699051429980828ad4f75d344ccf07ef9a9eb68ea2fd242a85e56c4b13cc
BLAKE2b-256 checksum
How to use checksums
77ab087cf384eaecafd7d9ba706b6b523b33ebc0d2912a1eb9fdc2fd6449b10c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Security for fsh-validator 0.3.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page