Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fhirpathpy

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fhirpathpy

FHIRPath implementation in Python

  • 1.1.1
  • Source
  • PyPI
  • Socket score

Maintainers
2

fhirpath.py

Build Status codecov pypi Supported Python version

FHIRPath implementation in Python

Parser was generated with antlr4

Getting started

Install

pip install fhirpathpy

Usage

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc