nazrulworld / fhirspec

FHIR Specification Loader
3 stars 5 forks source link
fhir fhir-parser fhir-resources fhirpath hl7 python-library python3

========================= FHIR Specification Parser

.. image:: https://img.shields.io/pypi/v/fhirspec.svg :target: https://pypi.org/project/fhirspec/

.. image:: https://img.shields.io/pypi/pyversions/fhirspec.svg :target: https://pypi.org/project/fhirspec/ :alt: Supported Python Versions

.. image:: https://img.shields.io/travis/com/nazrulworld/fhirspec.svg :target: https://app.travis-ci.com/github/nazrulworld/fhirspec

.. image:: https://codecov.io/gh/nazrulworld/fhirspec/branch/master/graph/badge.svg :target: https://codecov.io/gh/nazrulworld/fhirspec/branch/master :alt: Test Coverage

.. image:: https://img.shields.io/lgtm/grade/python/g/nazrulworld/fhirspec.svg?logo=lgtm&logoWidth=18 :target: https://lgtm.com/projects/g/nazrulworld/fhirspec/context:python :alt: Language grade: Python

.. image:: https://img.shields.io/pypi/l/fhirpath.svg :target: https://pypi.org/project/fhirspec/ :alt: License

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black

.. image:: https://www.hl7.org/fhir/assets/images/fhir-logo-www.png :target: https://www.hl7.org/fhir/ :alt: HL7® FHIR®

Python representation of FHIR® https://www.hl7.org/fhir/ specification. Idea and class structure based on https://github.com/smart-on-fhir/fhir-parser.

Usages

fhirspec.Configuration

A class that is controlling the behavior of fhirspec.FHIRSpec, powerful but very convenient. In several ways it is possible to construct the instance, ie. from JSON file (has support for json5 <https://json5.org/>_), from python module, from TOML file, from plain text file, and so on. Only capital letter's variables are accepted

import pathlib import os from foo.module import bar from fhirspec import Configuration config1 = Configuration.from_module(bar) config2 = Configuration.from_json_file(pathlib.Path("/json/file/location")) data_dict = { ... "BASE_URL": pathlib.Path(os.path.abspath(file)) ... } config3 = Configuration(data_dict=data_dict)

fhirspec.FHIRSpec

The main loader class, to construct this instance, Configuration: is required parameter and additionally source of json files. Bellows variables should have to be present in configuration.

required_variables = [
    "WRITE_RESOURCES", "CLASS_MAP", "REPLACE_MAP", "NATIVES",
    "JSON_MAP", "JSON_MAP_DEFAULT", "RESERVED_MAP", "ENUM_MAP",
    "ENUM_NAME_MAP", "DEFAULT_BASES", "MANUAL_PROFILES", "CAMELCASE_CLASSES",
    "CAMELCASE_ENUMS", "BACKBONE_CLASS_ADDS_PARENT", "RESOURCE_MODULE_LOWERCASE",]

from fhirspec import Configuration from fhirspec import FHIRSpec config = Configuration( ... { ... "BASE_PATH": "", "WRITE_RESOURCES": True ... } ... ) spec = FHIRSpec(config) "patient" in spec.profiles True

download

A perfect tool to download any file from server, no dependency on third-party library.

from fhirspec import download url = "http://www.africau.edu/images/default/sample.pdf" download_directory = pathlib.Path(os.path.expanduser("~/Downloads")) download(url, download_directory) (download_directory / "sample.pdf").exists() True

History

0.4.0 (22-12-2022)

0.3.0 (18-03-2021)

0.2.5 (02-11-2020)

0.2.4 (02-11-2020)

0.2.3 (24-09-2020)

Update to version 0.2.4 is recommended

0.2.1 (15-06-2020)

0.2.0 (06-06-2020)

0.1.0 (28-04-2020)


© Copyright HL7® logo, FHIR® logo and the flaming fire are registered trademarks owned by Health Level Seven International <https://www.hl7.org/legal/trademarks.cfm?ref=https://pypi.org/project/fhir-resources/>_

"FHIR® is the registered trademark of HL7 and is used with the permission of HL7. Use of the FHIR trademark does not constitute endorsement of this product by HL7"