Skip to main content

Stores FHIR JSON resources in compressed form in memory

Project description

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.

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

compressedfhir-1.0.7.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

compressedfhir-1.0.7-py3-none-any.whl (61.3 kB view details)

Uploaded Python 3

File details

Details for the file compressedfhir-1.0.7.tar.gz.

File metadata

  • Download URL: compressedfhir-1.0.7.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for compressedfhir-1.0.7.tar.gz
Algorithm Hash digest
SHA256 b8e9953edf5e9b9f1eb89324a8410544e81e38aaaa0652767891d332da352b36
MD5 009d20fb73c8f3b44b081d65595757c3
BLAKE2b-256 640e53d415f8d7ff16b493c01b1f305f99d9a30249d6db680340330ba77aec6e

See more details on using hashes here.

File details

Details for the file compressedfhir-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: compressedfhir-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 61.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for compressedfhir-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 aa36ad0eaf7f1e49be16d7e1b8aae0ccc9ac39e5ac670640cd730b8f0bcfe8c7
MD5 c2edb3b367a8b6cbafdf1f7a211d4f1e
BLAKE2b-256 b0cd1bfbbde8ed6fa7f373f7090f98d1e96129a1a0f597adcaeb6c6536518bac

See more details on using hashes here.

Supported by

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