Skip to main content

Compressed FHIR

A Python library for storing FHIR JSON resources in a compressed form in memory, optimizing memory usage while maintaining fast access to FHIR data.

Overview

Compressed FHIR is a specialized library that provides efficient memory storage for FHIR (Fast Healthcare Interoperability Resources) JSON resources. It uses zlib or msgpack for compression while ensuring quick access to the stored healthcare data.

Features

  • Efficient memory storage of FHIR resources
  • Fast access to compressed FHIR data
  • Compatible with standard FHIR JSON formats
  • Minimal memory footprint
  • Python 3.12+ support

Installation

You can install the package using pip:

pip install compressedfhir

Or using uv:

uv add compressedfhir

Requirements

  • Python 3.12 or higher
  • msgpack >= 1.0.0
  • orjson >= 3.11.6

Usage

from typing import Any

from compressedfhir.fhir.fhir_resource import FhirResource
from compressedfhir.utilities.compressed_dict.v1.compressed_dict_storage_mode import CompressedDictStorageMode


resource1 = FhirResource(
    initial_dict={"resourceType": "Observation", "id": "456"},
    storage_mode=CompressedDictStorageMode.default(),
)

my_dict: dict[str, Any] = resource1.dict()
my_plain_dict: dict[str, Any] = resource1.to_plain_dict()
my_json: str = resource1.json()

with resource1.transaction():
   assert "email" not in resource1
   assert resource1.get("name") == "Custom Mode User"
   assert resource1.get("active") is True

Development Setup

  1. Clone the repository:

    git clone https://github.com/icanbwell/compressed-fhir.git
    cd compressed-fhir
    
  2. Install dependencies using uv:

    uv sync --group dev
    
  3. Set up pre-commit hooks:

    pre-commit install
    

Docker Support

The project includes Docker support for development and deployment:

# Build the Docker image
docker build -t compressed-fhir .

# Run using docker-compose
docker-compose up

Contributing

Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Authors

Support

For support, please open an issue in the GitHub repository or contact the maintainers.

Project Status

Current status: Beta

The project is under active development. Please check the GitHub repository for the latest updates and changes.

Metadata

Release files for compressedfhir 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for compressedfhir 4.0.0
File Size Uploaded Provenance Actions
compressedfhir-4.0.0.tar.gz 46.5 kB Without provenance Details for compressedfhir-4.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for compressedfhir 4.0.0
File Interpreter ABI Platform Actions
compressedfhir-4.0.0-py3-none-any.whl Python 3 none any Details for compressedfhir-4.0.0-py3-none-any.whl

Total release size: 109.4 kB

Release files / compressedfhir-4.0.0.tar.gz

Download URL compressedfhir-4.0.0.tar.gz
Size 46.5 kB
Tags Source
SHA-256 checksum
How to use checksums
012b3533d2179eb9c89dc9bc77358e96f5f0005075a3652c3e8260aaf256a9ed
BLAKE2b-256 checksum
How to use checksums
8a7899291a478131b905244db99dbd38ff02520a0703f7b08f9cef3b2064306d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / compressedfhir-4.0.0-py3-none-any.whl

Download URL compressedfhir-4.0.0-py3-none-any.whl
Size 62.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f7613380cb2009de00fdc3948b2564aafbefe22d54b04bb225e825e15fb967a
BLAKE2b-256 checksum
How to use checksums
f3850bc10d04f99555db4895a0f1d3a908b4a3ce10bf57a9f9ab58262829b479
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for compressedfhir 4.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page