Snotra - Health registry research using Pandas and Python
Snotra is a tool that extends and builds on the Pandas library to make it easier to analyze data on hospital events, prescriptions and similar types of health data.
Snotra is a also a Norse goddess associated with wisdom.
Examples
-
Count the number of unique persons with a diagnosis in event data
- Using special notation (star, hyphen and colon)
df.count_persons(codes=['K50*', 'K51*'], cols='icd*') df.count_persons(codes=['K50.0-K51.9'], cols='icd*')
- Using logical expressions
df.count_persons(codes='K50 or K51 and not K52', cols='icd*') df.count_persons(codes='K50 in: icd and 4AB02 in:atc1, atc2')
-
Select all events for some persons using codelists or logical expressions
df.select_persons(codes=['K50*', 'K51*'], cols='icd') df.select_persons(codes='(K50 or K51) and not K52', cols='icd')
-
Count the number of unique codes in multiple columns with multiple values in each cell
df['icd_primary', 'icd_secondary'].count_codes(sep=',')
-
Calculate Charlson Comorbidity Index*
cci = sa.charlson(df=df, cols=['icd1', 'icd2'], sep=',')
Installation
-
We recommend using 'sa' as an abbreviation for snotra
pip install snotra as sa
Requirements
- Python 3.6
- Pandas
License
MIT
Documentation
Draft overview of methods and functions doc
Disclaimer
Snotra is currently under development and not ready for production. Much remains to be tested and corrected, use at your own risk - and contributions are welcome!
Features
-
Easy and efficient notation and methods to deal with medical codes: Medical data often use special code systems to indicate diagnoses, pharmaceuticals and medical procedures. We integrated these tools and allow the use of different types of notation (star, hyphen, colon) to make it easy to select or count the relevant patients.
-
Answer person level question using event level data: Often health data contains information about events (a prescription, a hospital stay), while the questions we want answered are both at the event-level and person-level:
- Event-level: How many doses of a certain pharmaceutical is used in a year?
- Person-level: How many people have received a given pharmaceutical?
We have methods, such as
count_personsthat make it easy to get person-level answers from event-level data.
-
Deal with messy data: Sometimes the files supplied to the analysis are multiple large files of messy administrative data. For instance procedure codes can be merged in one column (comma separated) or spread across many columns. To deal with this we have methods that accept both types of data. For instance: the method
count_codes()can count codes from many columns, some of which may contain comma seperated codes, some of which may be single valued.
Metadata
Release files for snotra 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| snotra-0.0.9.tar.gz | 3.7 MB | Without provenance | Details for snotra-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| snotra-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for snotra-0.0.9-py3-none-any.whl |
Total release size: 7.5 MB
Release files / snotra-0.0.9.tar.gz
| Download URL | snotra-0.0.9.tar.gz |
|---|---|
| Size | 3.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc6120ae609dd695f0adaae737cd3074e7e4fcc04065bb9f02a14d1ec82e51aa
|
|
BLAKE2b-256 checksum How to use checksums |
162d2247789a20ae1e5e29174b8bf01f62c48ce260aeca0512373366843474d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|
Release files / snotra-0.0.9-py3-none-any.whl
| Download URL | snotra-0.0.9-py3-none-any.whl |
|---|---|
| Size | 3.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72773504c70e8de5b07c0ac7d858938bee8d6690ac9efefe0be744b2d7a4190d
|
|
BLAKE2b-256 checksum How to use checksums |
df607b9ffc8a4d8872d4dc71058a1d6f463c7964755c1e3b4876cc15e8adefbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|
Security for snotra 0.0.9
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.