fhirpathpy


Namefhirpathpy JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryFHIRPath implementation in Python
upload_time2024-07-14 22:31:28
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords fhir fhirpath
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            fhirpath.py
===========

[![Build Status](https://github.com/beda-software/fhirpath-py/actions/workflows/build.yaml/badge.svg)](https://github.com/beda-software/fhirpath-py/actions)
[![codecov](https://codecov.io/gh/beda-software/fhirpath-py/branch/master/graph/badge.svg)](https://codecov.io/gh/beda-software/fhirpath-py)
[![pypi](https://img.shields.io/pypi/v/fhirpathpy.svg)](https://pypi.org/project/fhirpathpy/)
[![Supported Python version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/release/python-380/)

[FHIRPath](https://www.hl7.org/fhir/fhirpath.html) implementation in Python

Parser was generated with [antlr4](https://github.com/antlr/antlr4)

# Getting started
## Install
`pip install fhirpathpy`

## Usage
```Python
from fhirpathpy import evaluate

patient = {
  "resourceType": "Patient",
  "id": "example",
  "name": [
    {
      "use": "official",
      "given": [
        "Peter",
        "James"
      ],
      "family": "Chalmers"
    },
    {
      "use": "usual",
      "given": [
        "Jim"
      ]
    },
    {
      "use": "maiden",
      "given": [
        "Peter",
        "James"
      ],
      "family": "Windsor",
      "period": {
        "end": "2002"
      }
    }
  ]
}

# Evaluating FHIRPath
result = evaluate(patient, "Patient.name.where(use='usual').given.first()", [])
# result: `['Jim']`
```

## evaluate
 > Evaluates the "path" FHIRPath expression on the given resource, using data
    from "context" for variables mentioned in the "path" expression.
    Parameters:
    resource (dict|list): FHIR resource, bundle as js object or array of resources This resource will be modified by this function to add type information.
    path (string): fhirpath expression, sample 'Patient.name.given'
    context (dict): a hash of variable name/value pairs.
    model (dict): The "model" data object specific to a domain, e.g. R4.
    Returns:
    int: Description of return value

## compile
> Returns a function that takes a resource and an optional context hash (see
    "evaluate"), and returns the result of evaluating the given FHIRPath
    expression on that resource.  The advantage of this function over "evaluate"
    is that if you have multiple resources, the given FHIRPath expression will
    only be parsed once.
    Parameters:
    path (string) - the FHIRPath expression to be parsed.
    model (dict) - The "model" data object specific to a domain, e.g. R4.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fhirpathpy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "fhir, fhirpath",
    "author": null,
    "author_email": "\"beda.software\" <fhirpath@beda.software>",
    "download_url": "https://files.pythonhosted.org/packages/6b/ca/2c3c11f4b14f31604f2ed2ba4f2d1e45ef235c04c6ce70c688c82099f7b2/fhirpathpy-1.1.1.tar.gz",
    "platform": null,
    "description": "fhirpath.py\n===========\n\n[![Build Status](https://github.com/beda-software/fhirpath-py/actions/workflows/build.yaml/badge.svg)](https://github.com/beda-software/fhirpath-py/actions)\n[![codecov](https://codecov.io/gh/beda-software/fhirpath-py/branch/master/graph/badge.svg)](https://codecov.io/gh/beda-software/fhirpath-py)\n[![pypi](https://img.shields.io/pypi/v/fhirpathpy.svg)](https://pypi.org/project/fhirpathpy/)\n[![Supported Python version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/release/python-380/)\n\n[FHIRPath](https://www.hl7.org/fhir/fhirpath.html) implementation in Python\n\nParser was generated with [antlr4](https://github.com/antlr/antlr4)\n\n# Getting started\n## Install\n`pip install fhirpathpy`\n\n## Usage\n```Python\nfrom fhirpathpy import evaluate\n\npatient = {\n  \"resourceType\": \"Patient\",\n  \"id\": \"example\",\n  \"name\": [\n    {\n      \"use\": \"official\",\n      \"given\": [\n        \"Peter\",\n        \"James\"\n      ],\n      \"family\": \"Chalmers\"\n    },\n    {\n      \"use\": \"usual\",\n      \"given\": [\n        \"Jim\"\n      ]\n    },\n    {\n      \"use\": \"maiden\",\n      \"given\": [\n        \"Peter\",\n        \"James\"\n      ],\n      \"family\": \"Windsor\",\n      \"period\": {\n        \"end\": \"2002\"\n      }\n    }\n  ]\n}\n\n# Evaluating FHIRPath\nresult = evaluate(patient, \"Patient.name.where(use='usual').given.first()\", [])\n# result: `['Jim']`\n```\n\n## evaluate\n > Evaluates the \"path\" FHIRPath expression on the given resource, using data\n    from \"context\" for variables mentioned in the \"path\" expression.\n    Parameters:\n    resource (dict|list): FHIR resource, bundle as js object or array of resources This resource will be modified by this function to add type information.\n    path (string): fhirpath expression, sample 'Patient.name.given'\n    context (dict): a hash of variable name/value pairs.\n    model (dict): The \"model\" data object specific to a domain, e.g. R4.\n    Returns:\n    int: Description of return value\n\n## compile\n> Returns a function that takes a resource and an optional context hash (see\n    \"evaluate\"), and returns the result of evaluating the given FHIRPath\n    expression on that resource.  The advantage of this function over \"evaluate\"\n    is that if you have multiple resources, the given FHIRPath expression will\n    only be parsed once.\n    Parameters:\n    path (string) - the FHIRPath expression to be parsed.\n    model (dict) - The \"model\" data object specific to a domain, e.g. R4.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "FHIRPath implementation in Python",
    "version": "1.1.1",
    "project_urls": {
        "Changelog": "https://github.com/beda-software/fhirpath-py/blob/master/CHANGELOG.md",
        "Documentation": "https://github.com/beda-software/fhirpath-py#readme",
        "Homepage": "https://github.com/beda-software/fhirpath-py",
        "Source": "https://github.com/beda-software/fhirpath-py.git"
    },
    "split_keywords": [
        "fhir",
        " fhirpath"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "246f81d2a02499d6e3f176bcaffbfbb50905ce38fd78cd37483c90754ef2445b",
                "md5": "e87a95421db8a820f92797b6c32b8a7d",
                "sha256": "d9247fc88234dc5dccdc4b1d814c1d7d7734001ae9825c7f444aade34bcfcd80"
            },
            "downloads": -1,
            "filename": "fhirpathpy-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e87a95421db8a820f92797b6c32b8a7d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 229435,
            "upload_time": "2024-07-14T22:31:26",
            "upload_time_iso_8601": "2024-07-14T22:31:26.750984Z",
            "url": "https://files.pythonhosted.org/packages/24/6f/81d2a02499d6e3f176bcaffbfbb50905ce38fd78cd37483c90754ef2445b/fhirpathpy-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6bca2c3c11f4b14f31604f2ed2ba4f2d1e45ef235c04c6ce70c688c82099f7b2",
                "md5": "594114a92dc882156da47c4a2deb58de",
                "sha256": "46149398002f9669bc4aa59d5f32dad7637dddc2c5b81ab8c0ddb09a1ceec9b9"
            },
            "downloads": -1,
            "filename": "fhirpathpy-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "594114a92dc882156da47c4a2deb58de",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 214435,
            "upload_time": "2024-07-14T22:31:28",
            "upload_time_iso_8601": "2024-07-14T22:31:28.703033Z",
            "url": "https://files.pythonhosted.org/packages/6b/ca/2c3c11f4b14f31604f2ed2ba4f2d1e45ef235c04c6ce70c688c82099f7b2/fhirpathpy-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-14 22:31:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "beda-software",
    "github_project": "fhirpath-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fhirpathpy"
}
        
Elapsed time: 4.26619s