fhir-core


Namefhir-core JSON
Version 0.1.0b8 PyPI version JSON
download
home_pagehttps://github.com/nazrulworld/fhir-core
SummaryFHIR Core library
upload_time2024-08-04 21:53:46
maintainerNone
docs_urlNone
authorMd Nazrul Islam
requires_python>=3.8
licenseBSD license
keywords fhir core resources python hl7 health it healthcare
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ==========
FHIR® Core
==========

.. image:: https://img.shields.io/pypi/v/fhir-core.svg
        :target: https://pypi.python.org/pypi/fhir-core

.. image:: https://img.shields.io/pypi/pyversions/fhir-core.svg
        :target: https://pypi.python.org/pypi/fhir-core
        :alt: Supported Python Versions

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

.. image:: https://ci.appveyor.com/api/projects/status/1av308hpof6c9u5q?svg=true
        :target: https://ci.appveyor.com/project/nazrulworld/fhir-core
        :alt: Windows Build

.. image:: https://codecov.io/gh/nazrulworld/fhir.resources/branch/master/graph/badge.svg
        :target: https://codecov.io/gh/nazrulworld/fhir-core

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

.. image:: https://static.pepy.tech/personalized-badge/fhir-core?period=total&units=international_system&left_color=black&right_color=green&left_text=Downloads
    :target: https://pepy.tech/project/fhir-core
    :alt: Downloads

.. image:: https://www.hl7.org/fhir/assets/images/fhir-logo-www.png
        :target: https://www.hl7.org/implement/standards/product_brief.cfm?product_id=449
        :alt: HL7® FHIR®

**Powered by Pydantic V2**. This library is developed for the support of the another libray `fhir.resources <https://github.com/nazrulworld/fhir.resources/>`_ but
you are more than welcome to use it for your own purpose. It provides an abstract base class for any FHIR resource model and `Primitive Datatypes <https://build.fhir.org/datatypes.html>`_
along with factories to create FHIR resource model and other complex datatypes.


Installation
------------

Just a simple ``pip install fhir-core``. But if you want development
version, just clone from https://github.com/nazrulworld/fhir-core and ``pip install -e .[dev]``.

Usages
------

**Example: 1**: This example creates an  Organization class with some of its attributes (id, active, name, address)::

    >>> from typing import List
    >>> from pydantic import Field
    >>> from fhir_core.fhirabstractmodel import FHIRAbstractModel
    >>> from fhir_core.types import IdType, BooleanType, StringType
    >>> data = {
    ...     "id": "f001",
    ...     "active": True,
    ...     "name": "Acme Corporation",
    ...     "address": ["Road 10": "Acme corporation", "2390", "USA"}]
    ... }
    >>> class Organization(FHIRAbstractModel):
    ...     __resource_type__ = "Organization"
    ...     id: IdType = Field(None, title="Id", alias="id", json_schema_extra={"element_property": True})
    ...     active: BooleanType = Field(None, title="Active", alias="active", json_schema_extra={"element_property": True})
    ...     name: StringType = Field(None, title="Name", alias="name", json_schema_extra={"element_property": True})
    ...     address: ListType[StringType] = Field(None, title="Address lines", alias="address", json_schema_extra={"element_property": True})
    ...
    ...     @classmethod
            def elements_sequence(cls):
                return ["id", "active", "name", "address"]
    ...
    >>> org = Organization.model_validate(data)
    >>> org.active is True
    True
    >>> org_json_str = org.model_dump_json()
    >>> Organization.model_validate_json(org_json_str).model_dump() == org.model_dump()
    True

**Complex examples**

    1. https://github.com/nazrulworld/fhir-core/blob/main/tests/fixtures/resources/extension.py
    2. https://github.com/nazrulworld/fhir-core/blob/main/tests/fixtures/resources/fhirtypes.py
    3. https://github.com/nazrulworld/fhir-core/blob/main/tests/fixtures/resources/codesystem.py

.. _`pydantic`: https://pydantic-docs.helpmanual.io/
.. _`FHIR`: https://www.hl7.org/implement/standards/product_brief.cfm

© 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/>`_

.. role:: strike
    :class: strike
.. role:: raw-html(raw)
    :format: html


=======
History
=======

0.1.0b8 (2024-08-04)
--------------------

- YAML dump & validate options are added into FHIRAbstractModel.


0.1.0b7 (2024-07-31)
--------------------

- typing hint added for the function ´´create_fhir_type´´ and ´´create_fhir_element_or_resource_type´´.


0.1.0b6 (2024-07-30)
--------------------

- Core configurations for types ``Id`` & ``String`` are coming from constraint module.

- Default maximum char length ``Id`` is now 255.


0.1.0b5 (2024-07-28)
--------------------

- Fixes the function that is checking is_primitive, as missing bytes and bytesarray are added.

- Encoding is handled for Base64Binary type.


0.1.0b4 (2024-07-28)
--------------------

- Fixes extension serialization.


0.1.0b3 (2024-07-28)
--------------------

- Fixes the function that is checking is_primitive.

- Fixes validator for Resource & Element types.


0.1.0b2 (2024-07-27)
--------------------

Bugfixes

- Fixes pattern as string for some of primitives types. fx UriType.

- Fixes model serializer.


0.1.0b1 (2024-07-26)
--------------------

- The first beta release! and this release is not stable enough to use in production.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nazrulworld/fhir-core",
    "name": "fhir-core",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "fhir, core, resources, python, hl7, health IT, healthcare",
    "author": "Md Nazrul Islam",
    "author_email": "email2nazrul@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0d/7e/6535dd4888f5384b2297c443884e613f8fa29646e891f2527848abc3e410/fhir_core-0.1.0b8.tar.gz",
    "platform": null,
    "description": "==========\nFHIR\u00ae Core\n==========\n\n.. image:: https://img.shields.io/pypi/v/fhir-core.svg\n        :target: https://pypi.python.org/pypi/fhir-core\n\n.. image:: https://img.shields.io/pypi/pyversions/fhir-core.svg\n        :target: https://pypi.python.org/pypi/fhir-core\n        :alt: Supported Python Versions\n\n.. image:: https://img.shields.io/travis/com/nazrulworld/fhir-core.svg\n        :target: https://app.travis-ci.com/github/nazrulworld/fhir-core\n\n.. image:: https://ci.appveyor.com/api/projects/status/1av308hpof6c9u5q?svg=true\n        :target: https://ci.appveyor.com/project/nazrulworld/fhir-core\n        :alt: Windows Build\n\n.. image:: https://codecov.io/gh/nazrulworld/fhir.resources/branch/master/graph/badge.svg\n        :target: https://codecov.io/gh/nazrulworld/fhir-core\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n\n.. image:: https://static.pepy.tech/personalized-badge/fhir-core?period=total&units=international_system&left_color=black&right_color=green&left_text=Downloads\n    :target: https://pepy.tech/project/fhir-core\n    :alt: Downloads\n\n.. image:: https://www.hl7.org/fhir/assets/images/fhir-logo-www.png\n        :target: https://www.hl7.org/implement/standards/product_brief.cfm?product_id=449\n        :alt: HL7\u00ae FHIR\u00ae\n\n**Powered by Pydantic V2**. This library is developed for the support of the another libray `fhir.resources <https://github.com/nazrulworld/fhir.resources/>`_ but\nyou are more than welcome to use it for your own purpose. It provides an abstract base class for any FHIR resource model and `Primitive Datatypes <https://build.fhir.org/datatypes.html>`_\nalong with factories to create FHIR resource model and other complex datatypes.\n\n\nInstallation\n------------\n\nJust a simple ``pip install fhir-core``. But if you want development\nversion, just clone from https://github.com/nazrulworld/fhir-core and ``pip install -e .[dev]``.\n\nUsages\n------\n\n**Example: 1**: This example creates an  Organization class with some of its attributes (id, active, name, address)::\n\n    >>> from typing import List\n    >>> from pydantic import Field\n    >>> from fhir_core.fhirabstractmodel import FHIRAbstractModel\n    >>> from fhir_core.types import IdType, BooleanType, StringType\n    >>> data = {\n    ...     \"id\": \"f001\",\n    ...     \"active\": True,\n    ...     \"name\": \"Acme Corporation\",\n    ...     \"address\": [\"Road 10\": \"Acme corporation\", \"2390\", \"USA\"}]\n    ... }\n    >>> class Organization(FHIRAbstractModel):\n    ...     __resource_type__ = \"Organization\"\n    ...     id: IdType = Field(None, title=\"Id\", alias=\"id\", json_schema_extra={\"element_property\": True})\n    ...     active: BooleanType = Field(None, title=\"Active\", alias=\"active\", json_schema_extra={\"element_property\": True})\n    ...     name: StringType = Field(None, title=\"Name\", alias=\"name\", json_schema_extra={\"element_property\": True})\n    ...     address: ListType[StringType] = Field(None, title=\"Address lines\", alias=\"address\", json_schema_extra={\"element_property\": True})\n    ...\n    ...     @classmethod\n            def elements_sequence(cls):\n                return [\"id\", \"active\", \"name\", \"address\"]\n    ...\n    >>> org = Organization.model_validate(data)\n    >>> org.active is True\n    True\n    >>> org_json_str = org.model_dump_json()\n    >>> Organization.model_validate_json(org_json_str).model_dump() == org.model_dump()\n    True\n\n**Complex examples**\n\n    1. https://github.com/nazrulworld/fhir-core/blob/main/tests/fixtures/resources/extension.py\n    2. https://github.com/nazrulworld/fhir-core/blob/main/tests/fixtures/resources/fhirtypes.py\n    3. https://github.com/nazrulworld/fhir-core/blob/main/tests/fixtures/resources/codesystem.py\n\n.. _`pydantic`: https://pydantic-docs.helpmanual.io/\n.. _`FHIR`: https://www.hl7.org/implement/standards/product_brief.cfm\n\n\u00a9 Copyright HL7\u00ae logo, FHIR\u00ae logo and the flaming fire are registered trademarks\nowned by `Health Level Seven International <https://www.hl7.org/legal/trademarks.cfm?ref=https://pypi.org/project/fhir-resources/>`_\n\n.. role:: strike\n    :class: strike\n.. role:: raw-html(raw)\n    :format: html\n\n\n=======\nHistory\n=======\n\n0.1.0b8 (2024-08-04)\n--------------------\n\n- YAML dump & validate options are added into FHIRAbstractModel.\n\n\n0.1.0b7 (2024-07-31)\n--------------------\n\n- typing hint added for the function \u00b4\u00b4create_fhir_type\u00b4\u00b4 and \u00b4\u00b4create_fhir_element_or_resource_type\u00b4\u00b4.\n\n\n0.1.0b6 (2024-07-30)\n--------------------\n\n- Core configurations for types ``Id`` & ``String`` are coming from constraint module.\n\n- Default maximum char length ``Id`` is now 255.\n\n\n0.1.0b5 (2024-07-28)\n--------------------\n\n- Fixes the function that is checking is_primitive, as missing bytes and bytesarray are added.\n\n- Encoding is handled for Base64Binary type.\n\n\n0.1.0b4 (2024-07-28)\n--------------------\n\n- Fixes extension serialization.\n\n\n0.1.0b3 (2024-07-28)\n--------------------\n\n- Fixes the function that is checking is_primitive.\n\n- Fixes validator for Resource & Element types.\n\n\n0.1.0b2 (2024-07-27)\n--------------------\n\nBugfixes\n\n- Fixes pattern as string for some of primitives types. fx UriType.\n\n- Fixes model serializer.\n\n\n0.1.0b1 (2024-07-26)\n--------------------\n\n- The first beta release! and this release is not stable enough to use in production.\n",
    "bugtrack_url": null,
    "license": "BSD license",
    "summary": "FHIR Core library",
    "version": "0.1.0b8",
    "project_urls": {
        "CI: Travis": "https://travis-ci.org/github/nazrulworld/fhir-core",
        "Coverage: codecov": "https://codecov.io/gh/nazrulworld/fhir-core",
        "GitHub: issues": "https://github.com/nazrulworld/fhir-core/issues",
        "GitHub: repo": "https://github.com/nazrulworld/fhir-core",
        "Homepage": "https://github.com/nazrulworld/fhir-core"
    },
    "split_keywords": [
        "fhir",
        " core",
        " resources",
        " python",
        " hl7",
        " health it",
        " healthcare"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e1a819e49c4dc4f3d377c8af50bdd0454911819abe47d5abcab61d03a897a5f",
                "md5": "3747dede4dfdcbecbb436a7e11245206",
                "sha256": "c713768b3f48058aee56bd0682d0e271139d1cd2520ab12caa948b081d64fe57"
            },
            "downloads": -1,
            "filename": "fhir_core-0.1.0b8-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3747dede4dfdcbecbb436a7e11245206",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.8",
            "size": 21337,
            "upload_time": "2024-08-04T21:53:45",
            "upload_time_iso_8601": "2024-08-04T21:53:45.067060Z",
            "url": "https://files.pythonhosted.org/packages/4e/1a/819e49c4dc4f3d377c8af50bdd0454911819abe47d5abcab61d03a897a5f/fhir_core-0.1.0b8-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0d7e6535dd4888f5384b2297c443884e613f8fa29646e891f2527848abc3e410",
                "md5": "8de8525d04f51902740f16df05ff7ef8",
                "sha256": "b49bf7b9dd5f82a10d4cd822f7d8657eed42c03ab50ac644e6a530e1b23fd898"
            },
            "downloads": -1,
            "filename": "fhir_core-0.1.0b8.tar.gz",
            "has_sig": false,
            "md5_digest": "8de8525d04f51902740f16df05ff7ef8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 23658,
            "upload_time": "2024-08-04T21:53:46",
            "upload_time_iso_8601": "2024-08-04T21:53:46.764450Z",
            "url": "https://files.pythonhosted.org/packages/0d/7e/6535dd4888f5384b2297c443884e613f8fa29646e891f2527848abc3e410/fhir_core-0.1.0b8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-04 21:53:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nazrulworld",
    "github_project": "fhir-core",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "appveyor": true,
    "lcname": "fhir-core"
}
        
Elapsed time: 3.90483s