FHIR Resources as Model Class
Project description
FHIR® Resources (R4)
All FHIR Resources are available as python class with built-in initial validation, exporter as json value.
Free software: BSD license
FHIR ResourceList: https://www.hl7.org/fhir/R4/resourcelist.html
Installation
Just a simple pip install fhir.resources or easy_install fhir.resources is enough. But if you want development version, just clone from https://github.com/nazrulworld/fhir.resources and python setup.py install.
Example: 1: Resource object created from json string:
>>> from fhir.resources.organization import Organization >>> from fhir.resources.address import Address >>> json_dict = {"resourceType": "Organization", ... "id": "mmanu", ... "active": True, ... "name": "Acme Corporation", ... "address": [{"country": "Swizterland"}] ... } >>> org = Organization(json_dict) >>> isinstance(org.address[0], Address) >>> True >>> org.address[0].country == "Swizterland" True >>> org.as_json()['active'] is True True
Example: 2: Construct resource object in python way:
>>> org = Organization() >>> org.id = "mmanu" >>> org.active = True >>> org.name = "Acme Corporation" >>> org.address = list() >>> address = Address() >>> address.country = "Swizterland" >>> org.address.append(address) >>> org.as_json() == json_dict True
Example: 3: Auto validation while providing wrong datatype:
>>> from fhir.resources.fhirabstractbase import FHIRValidationError >>> try: ... org = Organization({"id": "fmk", "address": ["i am wrong type"]}) ... raise AssertionError("Code should not come here") ... except FHIRValidationError: ... pass
Release and Version Policy
This package is following FHIR® release and versioning policy, for example say, FHIR releases next version 4.0.1, we also release same version here.
Credits
All FHIR® Resources (python classes) are generated using fhir-parser.
This package skeleton was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
© Copyright HL7® logo, FHIR® logo and the flaming fire are registered trademarks owned by Health Level Seven International
History
4.0.0b1 (2019-01-13)
[FHIR] FhirVersion=4.0.0-a53ec6ee1b version=4.0.0 buildId=a53ec6ee1b date=20181227223754
3.0.1 (2019-01-13)
[FHIR] FhirVersion=3.0.1.11917 version=3.0.1 revision=11917 date=20170419074443
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fhir.resources-4.0.0b1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27e55cd4f673c3b1253068a888f2247ea386f76ab7b8c7f761d95ee48ca8f781 |
|
MD5 | ba20f80ddada10fce26e167488811974 |
|
BLAKE2b-256 | 75cd11ac0c7489e62e05c5717c6472bafe2b6a566f9927490df48605a4540037 |