Skip to main content

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)

Quick overview of Medical Billing

Medical billing is far too complicated to go into detail here, but at a high level there's two options:

Self/Cash Payer

In the event that one doesn't have or chooses not to use insurance, the cost of the procedure is simply the cost billed (the gross charge). Traditionally, most institutions offer a discount of some kind since there's less paperwork.

Insurance

Most insurance plans group providers into in-network or out-of-network. In the case of HMO's (Health Maintanence Organizations), they will generally only reimburse for in-network (their own) facilities. For Preferred Provider Organiztion (PPO) plans, the set of in-network providers tends to be much larger and there is often partial coverage for out-of-network providers. The theory was that large insurers would negotiate reduced rates at in-network-providers (thus reducing their costs) in exchange for providing a guaranteed stream of patients to said providers.

The amount an insurer will pay a provider is often referred to as the "allowable amount" or "contract rate". These are typically considered confidential between the provider and the insurer and are not shared with patients even when asked leading to a great deal of frustration. The insured patient then accounts for their policies rules on co-insurance (cost sharing), co-pay (fixed fee for a class of services), and deductible and ultimately arrives at their final out-of-pocket cost.

The algorithm normally goes like this:

  1. Provider bills the insurer their chargemaster gross fee
  2. The insurer finds the contract rate and discounts the gross fee accordingly (there are odd situations where the billed amount is less than the contract rate but this is rare)
  3. The insurer computes the patients portion based on their deductible, copay, and coinsurance and deducts this from the contract rate
  4. The insurer pays the provider their portion
  5. The provider bills the patient for the contract rate less the amount the insurance paid

Fields

  • location - Some providers have a different chargemaster per facility
  • procedure_identifier - A unique identifer for the chargemaster entry. Typically this isn't useful beyond tracking over time
  • procedure_description - The human readable name of the chargemaster etnry, though often riddled with abbreviations and shorthand
  • ndc_code - National Drug Code. For medication/medical goods line-items.
  • nubc_revenue_code - Some institutions also list a National Uniform Billing Code though it's rare and not super useful
  • cpt_code: CPT© (Current Procedural Terminology) Code - A subset of HCPCS codes that these are copyrighted and require licensing for use.
  • hcpcs_code: Healthcare Common Procedure Coding System codes. These are provided by the National Institute of Health NIH and, with the exception of the CPT subset, free to use
  • ms_drg_code: Medicare Severity Diagnosis Related Groups code. For hospitalizations rather than procedures.
  • max_reimbursement: The maximum amount that the insurer(s) reimbursed the provider. Note this is less than or equal to the contract rate where applicable
  • min_reimbursement: The minimum amount that the insurer(s) reimbursed the provider.
  • expected_reimbursement: Presumably this is average amount that insurer(s) reimbursed the provider but it's not well defined and likely depends on the institution.
  • in_patient: True/False if the chargemaster item was specifically for an in-patient procedure/MS-DRG
  • payer: The insurance provider name or "Cash" for self payment (or None where the item is an aggregate)
  • plan: Where known, the plan name under the payer
  • gross_charge: The amount billed. For "Cash" payer, this often accounts for the discount
  • charge_code: The providers internal charge code. Useless outside the organization
  • quantity: Typically for drug line items
  • in_patient_price: UCSD provides this though it's likely going to be deprecated soon

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:

Metadata

Release files for chargemaster-parsers 0.0.4

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

Source distribution (sdist)

Source distribution for chargemaster-parsers 0.0.4
File Size Uploaded Provenance Actions
chargemaster_parsers-0.0.4.tar.gz 30.1 kB Without provenance Details for chargemaster_parsers-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chargemaster-parsers 0.0.4
File Interpreter ABI Platform Actions
chargemaster_parsers-0.0.4-py3-none-any.whl Python 3 none any Details for chargemaster_parsers-0.0.4-py3-none-any.whl

Total release size: 52.2 kB

Release files / chargemaster_parsers-0.0.4.tar.gz

Download URL chargemaster_parsers-0.0.4.tar.gz
Size 30.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c740f3de9fdcc75d756c845708417f7ce9d295c17cbf8cb61529c62d27ce401e
BLAKE2b-256 checksum
How to use checksums
d59213962acca0d1744b97b6dc28cb1f90a688a345496290aa14d1c7da4feb7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / chargemaster_parsers-0.0.4-py3-none-any.whl

Download URL chargemaster_parsers-0.0.4-py3-none-any.whl
Size 22.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2350d5f7b56b17d83713d755d388978205109d38b323ed0e7ddcdd084311230
BLAKE2b-256 checksum
How to use checksums
555ed1a8ba38f50604081c6f95200f783f87a73ab2d6272022c1388b66edf3b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Security for chargemaster-parsers 0.0.4

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