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.10+ support

Installation

You can install the package using pip:

pip install compressedfhir

Or using pipenv:

pipenv install compressedfhir

Requirements

  • Python 3.10 or higher
  • msgpack >= 1.0.0
  • orjson >= 3.10.16

Usage

from typing import Any
from collections import OrderedDict

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: OrderedDict[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 pipenv:

    pipenv install --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 3.0.5

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 3.0.5
File Size Uploaded
compressedfhir-3.0.5.tar.gz 45.4 kB Details

Built distribution (wheel)

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

Total release size: 107.6 kB

Release files / compressedfhir-3.0.5.tar.gz

Download URL compressedfhir-3.0.5.tar.gz
Size 45.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e55aea45d1e039b2da0817a2a9ea6bd404449406b8f505ea9e9d29fe82229ce0
BLAKE2b-256 checksum
How to use checksums
e0c415c022b5f15c2f7596e0862eaab76fffc00c9dabd64178b3ad5a5322a60b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

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

Download URL compressedfhir-3.0.5-py3-none-any.whl
Size 62.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
088d6a69435fc547ea530f1bddb883031bc941b0f092718b6cab5a5ff6182b10
BLAKE2b-256 checksum
How to use checksums
e42990e7a47fbf49cd6adbfd1c774f6bc93a6d4df923e0f664bf6726bfe09cbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

3.0.5 This release

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

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