Skip to main content

A library for parsing machine readable healthcare chargemasters

Project description

chargemaster_parsers

Healthcare Chargemaster Parsers

Goals

The primary objective for now is to process (where available) the outpatient data from chargemasters for healthcare institutions in California. The output should be a collection of objects with a common interface to simplify bulk processing.

Requirements

Python 3.9+

Running Unit tests

Unit tests are implemented in pytest and are located in the src/tests directory. To run, you must first create a virtual environment and install the package (preferably in editable mode for local testing). As an example using the venv module:

cd src
python -m venv venv
venv/scripts/Activate
pip install -e .

Next install pytest

pip install pytest

Then to run the tests:

python -m pytest

Downloading and parsing

To utilize the library for a particular institution:

from chargemaster_parsers.parsers import ChargeMasterParser

# Choose your institution
institution = "scripps"

# Create a parser for it - either use the factory method and give it an
# institution name, or you can import the specific parser subclass you want
#
# from chargemaster_parsers.parsers import ScrippsChargeMasterParser
# parser = ScrippsChargeMasterParser()

parser = ChargeMasterParser.build(institution)

# Download the artifacts however you see fit - note this way requires a lot of
# RAM - you will likely need to store them off to disk. For now make a pretend
# file in memory with io. Note that some institutions may require headers that
# look like a browser or they will fail.
import urllib.request
import io

artifacts = {}
for artifact_url in parser.artifact_urls:
    with urllib.request.urlopen(artifact_url) as response:
        artifacts[artifact_url] = io.BytesIO(response.read())

# Parse the downloaded artifacts into chargemaster entries
for chargemaster_entry in parser.parse_artifacts(artifacts):
    print(chargemaster_entry)

Prior works to reference:

This is certainly not the first, nor will it be the last attempt at this. Many have had similar ideas, though most are ultimately doomed to become out of date.

Some that I've found so far:

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

chargemaster_parsers-0.0.2.tar.gz (17.7 kB view hashes)

Uploaded Source

Built Distribution

chargemaster_parsers-0.0.2-py3-none-any.whl (14.1 kB view hashes)

Uploaded Python 3

Supported by

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