fsh-validator


Namefsh-validator JSON
Version 0.3.5 PyPI version JSON
download
home_pagehttps://github.com/glichtner/fsh-validator
SummaryFHIR Shorthand Validator unshortens fsh input and validates all defined instances against their profiles.
upload_time2024-02-08 08:43:42
maintainer
docs_urlNone
authorGregor Lichtner
requires_python>=3.6
licenseBSD license
keywords fsh-validator
VCS
bugtrack_url
requirements jsonpath_ng pandas openpyxl tabulate pyyaml
Travis-CI
coveralls test coverage No coveralls.
            ========================
FHIR Shorthand Validator
========================


.. image:: https://img.shields.io/pypi/v/fsh-validator.svg
        :target: https://pypi.python.org/pypi/fsh-validator

.. image:: https://img.shields.io/travis/glichtner/fsh-validator.svg
        :target: https://travis-ci.com/glichtner/fsh-validator

.. image:: https://readthedocs.org/projects/fsh-validator/badge/?version=latest
        :target: https://fsh-validator.readthedocs.io/en/latest/?version=latest
        :alt: Documentation Status


.. image:: https://pyup.io/repos/github/glichtner/fsh-validator/shield.svg
     :target: https://pyup.io/repos/github/glichtner/fsh-validator/
     :alt: 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.

.. _SUSHI: https://github.com/FHIR/sushi
.. _`HL7 FHIR Validator`: https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Validator

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:

.. code-block:: yaml

    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.


.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage


=======
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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/glichtner/fsh-validator",
    "name": "fsh-validator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "fsh-validator",
    "author": "Gregor Lichtner",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/40/53/d4a9bb10a6c28d69b0a6d2f2cdb2b9ff009d49f6ac29f5421abca04c2565/fsh-validator-0.3.5.tar.gz",
    "platform": null,
    "description": "========================\nFHIR Shorthand Validator\n========================\n\n\n.. image:: https://img.shields.io/pypi/v/fsh-validator.svg\n        :target: https://pypi.python.org/pypi/fsh-validator\n\n.. image:: https://img.shields.io/travis/glichtner/fsh-validator.svg\n        :target: https://travis-ci.com/glichtner/fsh-validator\n\n.. image:: https://readthedocs.org/projects/fsh-validator/badge/?version=latest\n        :target: https://fsh-validator.readthedocs.io/en/latest/?version=latest\n        :alt: Documentation Status\n\n\n.. image:: https://pyup.io/repos/github/glichtner/fsh-validator/shield.svg\n     :target: https://pyup.io/repos/github/glichtner/fsh-validator/\n     :alt: Updates\n\n\n\nFHIR Shorthand Validator (fsh-validator) unshortens fsh input and validates all defined instances against their profiles.\n\nfsh-validator is an interface to `SUSHI`_ and the `HL7 FHIR Validator`_ running the following workflow:\n\n1. Run SUSHI to unshorten fsh files to structure definitions, instances, value sets etc.\n2. Detect all defined profiles, valuesets and instances.\n3. Validate all defined instances using the official HL7 FHIR Validator against their profiles.\n\n\nFor the full documentation see https://fsh-validator.readthedocs.io.\n\n.. _SUSHI: https://github.com/FHIR/sushi\n.. _`HL7 FHIR Validator`: https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Validator\n\nQuickstart\n----------\n\nInstall the latest fsh-validator::\n\n    pip install -U fsh-validator\n\nOr directly from github repository::\n\n    pip install -U git+https://github.com/glichtner/fsh-validator\n\nRun fsh-validator in your fsh project path::\n\n    $ fsh-validator --all\n\n\nParameters\n----------\n\n::\n\n    usage: fsh-validator [-h] [--all] [--subdir SUBDIR] [--validator-path PATH_VALIDATOR] [--verbose] [--no-sushi] [--log-path LOG_PATH] [filename [filename ...]]\n\n    positional arguments:\n      filename              fsh file names (basename only - no path)\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      --all                 if set, all detected profiles will be validated\n      --subdir SUBDIR       Specifies the subdirectory (relative to input/fsh/) in which to search for profiles if --all is set\n      --validator-path PATH_VALIDATOR\n                            path to validator\n      --verbose             Be verbose\n      --no-sushi            Do not run sushi before validating\n      --log-path LOG_PATH   log file path - if supplied, log files will be written\n\nConfiguration\n-------------\n\nfsh-validator reads an optional configuration file ``.fsh-validator.yml`` in the base directory of the sushi project.\nThe configuration file currently supports the following parameters:\n\n    exclude_code_systems:\n        A list of code systems to exclude from validation. If an instance contains a code from a code system in this list,\n        the instance will be skipped. This is useful to exclude code systems that are not yet supported by the validator\n        or that may cause problems when validating (e.g. ICD-10-gm)\n        The code systems are specified by their canonical URI.\n        The default is to not exclude any code systems.\n\n    exclude_resource_types:\n        A list of resource types to exclude from validation. If an instance implements a resource of a type in this list,\n        the instance will be skipped. This is useful to exclude resources that are not yet supported by the validator\n        or that may cause problems when validating.\n        The resource types are specified by their canonical name (e.g. \"Bundle\").\n        The default is to not exclude any resource types.\n\n\nExample configuration file:\n\n.. code-block:: yaml\n\n    exclude_code_systems:\n        - http://hl7.org/fhir/sid/icd-10-cm\n        - http://fhir.de/CodeSystem/bfarm/icd-10-gm\n\n    exclude_resource_types:\n        - Bundle\n        - OperationOutcome\n\nExamples\n--------\n\n**Example call to validate a *single* profile**\n\n::\n\n    $ cd ExampleIG/\n    $ fsh-validator input/fsh/p-thoracic-drainage.fsh\n\n\n**Example call to validate *all* profiles**\n\nThe following call validates all profiles in the subdirectory \"vaccination/\" and writes the results of the validation\nlog files in the directory logs/.\n\n::\n\n  $ cd ExampleIG/\n  $ fsh-validator --all --subdir vaccination/ --log-path logs/\n\n\nThis is equivalent to calling::\n\n    $ fsh-validator input/fsh/vaccination/*.fsh --log-path logs/\n\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\n=======\nHistory\n=======\n\n0.3.1 (2022-11-30)\n------------------\n\n* Fixed validation when profiles are not known from the FHIR package cache\n\n0.3.0 (2022-11-29)\n------------------\n\n* Validation speed increased by batch processing of files\n\n0.2.2 (2021-11-10)\n------------------\n\n* Fixed processing of bundle resources\n* Fixed processing of profiles that have parent profiles defined in the same project\n* Added possibility to exclude certain types of resources from validation (via .fsh-validator.yml file)\n* Added exclusion of abstract profiles from validation\n\n0.2.1 (2021-11-11)\n------------------\n\n* Improved output messages\n\n0.2.0 (2021-11-11)\n------------------\n\n* Added possibility to excluding specific code systems from validation\n\n0.1.9 (2021-11-09)\n------------------\n\n* Added workaround function for invalid SUSHI outputs (duplicated codings in MII Laboratory Observation Profile)\n\n0.1.8 (2021-11-08)\n------------------\n\n* Added support for extensions\n\n0.1.7 (2021-11-05)\n------------------\n\n* Added requirements to setup.py\n\n0.1.6 (2021-11-05)\n------------------\n\n* Reading FHIR version to use in validator from sushi-config.yaml\n\n0.1.5 (2021-11-03)\n------------------\n\n* Fixed validation of questionnaires\n\n0.1.4 (2021-11-02)\n------------------\n\n* Fixed instances/profiles regex for aliases\n\n0.1.3 (2021-10-25)\n------------------\n\n* Fixed FshPath\n\n0.1.2 (2021-10-25)\n------------------\n\n* Added requirements to setup.py\n\n0.1.1 (2021-10-25)\n------------------\n\n* Fix python package\n\n0.1.0 (2021-10-25)\n------------------\n\n* First release on PyPI.\n",
    "bugtrack_url": null,
    "license": "BSD license",
    "summary": "FHIR Shorthand Validator unshortens fsh input and validates all defined instances against their profiles.",
    "version": "0.3.5",
    "project_urls": {
        "Homepage": "https://github.com/glichtner/fsh-validator"
    },
    "split_keywords": [
        "fsh-validator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "77ab087cf384eaecafd7d9ba706b6b523b33ebc0d2912a1eb9fdc2fd6449b10c",
                "md5": "b4cd6823eafa4b62f033e7e4567f2bb0",
                "sha256": "2a6f699051429980828ad4f75d344ccf07ef9a9eb68ea2fd242a85e56c4b13cc"
            },
            "downloads": -1,
            "filename": "fsh_validator-0.3.5-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b4cd6823eafa4b62f033e7e4567f2bb0",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 19113,
            "upload_time": "2024-02-08T08:43:41",
            "upload_time_iso_8601": "2024-02-08T08:43:41.016784Z",
            "url": "https://files.pythonhosted.org/packages/77/ab/087cf384eaecafd7d9ba706b6b523b33ebc0d2912a1eb9fdc2fd6449b10c/fsh_validator-0.3.5-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4053d4a9bb10a6c28d69b0a6d2f2cdb2b9ff009d49f6ac29f5421abca04c2565",
                "md5": "b1f1049837f9f7f5953ac4ac39f76d12",
                "sha256": "5b282a116379db23db3bdc5f1038c57168478c09736c984ee6367c602b2e3ae8"
            },
            "downloads": -1,
            "filename": "fsh-validator-0.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "b1f1049837f9f7f5953ac4ac39f76d12",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 25644,
            "upload_time": "2024-02-08T08:43:42",
            "upload_time_iso_8601": "2024-02-08T08:43:42.705528Z",
            "url": "https://files.pythonhosted.org/packages/40/53/d4a9bb10a6c28d69b0a6d2f2cdb2b9ff009d49f6ac29f5421abca04c2565/fsh-validator-0.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-08 08:43:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "glichtner",
    "github_project": "fsh-validator",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "jsonpath_ng",
            "specs": [
                [
                    ">=",
                    "1.6.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "2.2.0"
                ]
            ]
        },
        {
            "name": "openpyxl",
            "specs": [
                [
                    "==",
                    "3.1.2"
                ]
            ]
        },
        {
            "name": "tabulate",
            "specs": [
                [
                    "==",
                    "0.9.0"
                ]
            ]
        },
        {
            "name": "pyyaml",
            "specs": [
                [
                    ">=",
                    "6.0.1"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "fsh-validator"
}
        
Elapsed time: 2.63160s