python-healthcard
This package aims to provide a simple way to read smart cards (healthcards from) the German health insurance system.
It is based off of this repo: https://github.com/asdil12/python-egk/
Installation
Simply install the package via pip:
pip install python-healthcard
Usage
HealthCardReader
The usage a pretty straightforward.
from healthcard.reader import HealthCardReader
reader = HealthCardReader()
healthcard = reader.get_health_card()
print(healthcard.patient.first_name)
Max
The HealthCardReader object is automatically looking for a card reader. If there are multiple card readers available it uses the first one be default. This behavior can be changed however:
# change the index of the used reader
reader = HealthCardReader(index=1)
# or instantiate a cardservice yourself
from smartcard.CardType import ATRCardType
from smartcard.CardRequest import CardRequest
from smartcard.util import toHexString, toBytes
cardtype = ATRCardType( toBytes( "3B 16 94 20 02 01 00 00 0D" ) ) # just an example APDU
cardrequest = CardRequest( timeout=1, cardType=cardtype )
cardservice = cardrequest.waitforcard()
# This example code is taken from https://pyscard.sourceforge.io/user-guide.html
reader = HealthCardReader(cardservice=cardservice)
There are currently 3 versions of healthcards defined: G1, G1plus and G2.
The package automatically detects the version and reads the data accordingly.
HealthCard
The HealthCard object provides a simple interface to access insurance and patient data:
healthcard.patient # Patient object
healthcard.insurance # Insurance object
healthcard.version # G1, G1plus or G2
It provides 2 JSON formatted outputs - a flattened as well as a hierarchical one:
healthcard.to_json()
# and
healthcard.to_flattened_json()
Patient
The Patient object contains the personal data of the healthcard:
patient.first_name
patient.insurant_id
patient.birthdate
patient.first_name
patient.last_name
patient.gender
patient.prefix
patient.name_addition
patient.title
# depends on version
patient.postal_address
# or
patient.residential_address
PostalAddress
address.city
address.zip_code
address.country_code
address.zip_code
address.mailbox
ResidenceAddress
address.city
address.zip_code
address.country_code
address.city
address.street
address.street_number
address.address_addition
Insurance
This object only contains the name of the insurance.
insurance.insurance_name
Metadata
Release files for python-healthcard 1.0.5
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 |
|---|---|---|---|---|
| python-healthcard-1.0.5.tar.gz | 13.3 kB | Without provenance | Details for python-healthcard-1.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_healthcard-1.0.5-py3-none-any.whl | Python 3 | none | any | Details for python_healthcard-1.0.5-py3-none-any.whl |
Total release size: 27.5 kB
Release files / python-healthcard-1.0.5.tar.gz
| Download URL | python-healthcard-1.0.5.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
905c06d4ea7e1238587df1bcf73e26489139f37db9e02242bcac7a120f13ce95
|
|
BLAKE2b-256 checksum How to use checksums |
49dc9460e9bb1f1da9e5ade026e934d83e92c2b360568ed30c0a681e8062a9ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Release files / python_healthcard-1.0.5-py3-none-any.whl
| Download URL | python_healthcard-1.0.5-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a34666ffb19c6ade9cc384f78b6613d3d53629b474b99971805c480fcf4b03c6
|
|
BLAKE2b-256 checksum How to use checksums |
6eb1a8592cda933f656768e929c608a6b1b21aa22a982f6160e105aa5597d438
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Security for python-healthcard 1.0.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.