Skip to main content

codeDx

codeDx (pronounced code-dex) is a codex for medical diagnosis codes — a lookup library for Swedish healthcare datasets. Install as pip install codedx, import as import codedx.

Built for regional datasets where ICD-10-SE (specialist care), KSH97-P (primary care), and rehab function codes coexist across many years and releases.

import codedx

# J440 exists in WHO, ICD-10-CM and ICD-10-SE
codedx.get_name("J440")               # 'Chronic obstructive pulmonary disease...'
codedx.get_name("J440", lang="sv")    # 'Kroniskt obstruktiv lungsjukdom...'
codedx.is_icd10who_code("J440")       # True
codedx.is_icd10cm_code("J440")        # True
codedx.is_icd10se_code("J440")        # True

codedx.get_ancestors("R060")          # ('R060', 'R06', 'R00-R09', '18')

# code_systems maps each system to its name in that system
codedx.code_systems("A00")
# {'icd10who': 'Cholera', 'icd10cm': 'Cholera', 'icd10se': 'Kolera'}
codedx.code_systems("UA3290")         # {'rehab': 'Kommunicera, att vara mottagare...'}

# KSH97-P sometimes uses colloquial names — G258 is 'Restless legs' in primary care
# but 'Andra specificerade basalgangliesjukdomar och rörelserubbningar' in ICD-10-SE
codedx.code_systems("G258")
# {'icd10se': 'Andra specificerade basalgangliesjukdomar och rörelserubbningar',
#  'ksh97p': 'Restless legs'}

Dots are dropped throughout, matching what is typically found in databases: A011 not A01.1.

Installation

pip install codedx

Downloads data at install time. Raw files are not redistributed due to licence restrictions.

Data sources

Classification files come from two Swedish authorities:

Ehälsomyndigheten maintains ICD-10-SE and KSH97-P. Files are downloaded from their Confluence collaboration platform. KSH97-P (primary care classification) is being phased out in favour of ICD-10-SE.

Socialstyrelsen retains responsibility for the NordDRG system and the associated rehab function codes (UA/UB series). These files are downloaded from Socialstyrelsen's website.

WHO ICD-10 (English) and ICD-10-CM are downloaded from WHO and the US CDC respectively.

Metadata

Release files for codedx 0.3.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 codedx 0.3.5
File Size Uploaded Provenance
codedx-0.3.5.tar.gz 10.7 kB Without provenance Details

Release files / codedx-0.3.5.tar.gz

Download URL codedx-0.3.5.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b74a519be2d396ebc111864223da641ecfea0a965301ea7e54ea6b4235fd17f4
BLAKE2b-256 checksum
How to use checksums
d1a20529c061de81fabf5d4876a72a3e28dbb2aa216e8f251517b5ce58e2007c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.15

Security for codedx 0.3.5

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.

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