Skip to main content

A guillotina framework powered fhirpath provider.

Project description

Introduction

https://img.shields.io/pypi/v/fhirpath_guillotina.svg https://img.shields.io/travis/nazrulworld/fhirpath_guillotina.svg Documentation Status Test Coverage

A guillotina framework powered fhirpath provider. Full battery included to use fhirpath more efficiently.

If you don’t know about FHIR® and HL7®, Please have a look here.

Quickstart

  1. Make sure fhirpath_guillotina is added as addon in your guillotina configure file.

  2. Make sure elasticsearch server configured properly.

  3. Make sure you have FHIR resource contenttypes registered (see example bellow).

  4. Make sure you have FHIR resources mapping (correct version) for elasticsearch.

Example: Add Contents:

>>> from fhirpath_guillotina.field import FhirField

class IOrganization(IFhirContent, IContentIndex):
    index_field(
        "organization_resource",
        type="object",
        field_mapping=fhir_resource_mapping("Organization"),
        fhirpath_enabled=True,
        resource_type="Organization",
        fhir_version=FHIR_VERSION.DEFAULT,
    )
    index_field("org_type", type="keyword")
    org_type = TextLine(title="Organization Type", required=False)
    organization_resource = FhirField(
        title="Organization Resource", resource_type="Organization", fhir_version="R4"
    )


@configure.contenttype(type_name="Organization", schema=IOrganization)
class Organization(Folder):
    """ """

    index(schemas=[IOrganization], settings={})
    resource_type = "Organization"

Example Search:

>>> from guillotina.component import query_utility
>>> from fhirpath.interfaces import ISearchContextFactory
>>> from fhirpath.interfaces import IFhirSearch
>>> search_context = query_utility(ISearchContextFactory).get(
...    resource_type="Organization"
... )
>>> search_tool = query_utility(IFhirSearch)
>>> params = (
...     ("active", "true"),
...     ("_lastUpdated", "2010-05-28T05:35:56+00:00"),
...     ("_profile", "http://hl7.org/fhir/Organization"),
...     ("identifier", "urn:oid:2.16.528.1|91654"),
...     ("type", "http://hl7.org/fhir/organization-type|prov"),
...     ("address-postalcode", "9100 AA")
... )
>>> fhir_bundle = await search_tool(params, context=search_context)
>>> fhir_bundle.total == len(fhir_bundle.entry)

Example FhirPath Query:

>>> from fhirpath.interfaces import IElasticsearchEngineFactory
>>> from guillotina.component import query_utility
>>> from fhirpath.enums import SortOrderType
>>> from fhirpath.fql import Q_
>>> from fhirpath.fql import T_
>>> from fhirpath.fql import V_
>>> from fhirpath.fql import sort_
>>> engine = query_utility(IElasticsearchEngineFactory).get()
>>> query_builder = Q_(resource="Organization", engine=engine)
>>> query_builder = (
...        query_builder.where(T_("Organization.active") == V_("true"))
...        .where(T_("Organization.meta.lastUpdated", "2010-05-28T05:35:56+00:00"))
...        .sort(sort_("Organization.meta.lastUpdated", SortOrderType.DESC))
...        .limit(20)
...    )
>>> query_result = query_builder(async_result=True)
>>> result = query_result.fetchall()
>>> result.header.total == 100
True
>>> len(result.body) == 20
True
>>> async for resource in query_result:
...     assert resource.resource_type == "Organization"

Credits

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

History

0.2.0 (2019-10-10)

0.1.0 (2019-08-24)

  • First release on PyPI. [nazrulworld]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fhirpath_guillotina-0.2.0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

fhirpath_guillotina-0.2.0-py2.py3-none-any.whl (14.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fhirpath_guillotina-0.2.0.tar.gz.

File metadata

  • Download URL: fhirpath_guillotina-0.2.0.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for fhirpath_guillotina-0.2.0.tar.gz
Algorithm Hash digest
SHA256 77ffc7c22ea7f0dac6b346bc1286fa60f2486701c819c3dcd7a6d44dcb461006
MD5 fa39b8580db97d3b3fd1d18dae3e95d2
BLAKE2b-256 1c2bfcfddecdddfc9482e3f6f52b4add6cdd59fab2928f2fa3159e8a3fe7cdc3

See more details on using hashes here.

File details

Details for the file fhirpath_guillotina-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: fhirpath_guillotina-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for fhirpath_guillotina-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 562ba19a298fa8972ce0214ca4251735f937ca412b40612bcf39fb1ee246c8d5
MD5 9be2fbc5140cc89bbf41c326f6c0359a
BLAKE2b-256 abcbfa01a246508cb474a0fb763f5ce8abde2da99e8a1857a13bc4402fd5a461

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page