ATF Library
Die App-Transport-Framework (ATF) Library ist eine Python-Bibliothek zur Verarbeitung und Handhabung von ATF-Nachrichten (https://simplifier.net/app-transport-framework) im FHIR-Format. Die Bibliothek bietet eine einfache Möglichkeit, verschiedene Anwendungsfälle und ihre zugehörigen Handler zu registrieren und zu verwalten.
Installation
Installieren Sie diese Bibliothek mit dem folgenden Befehl:
pip install app-transport-framework-library
Verwendung
- Importieren Sie die benötigten Klassen und Funktionen aus der Bibliothek:
from app_transport_framework_library.atf_bundle_processor import ATF_BundleProcessor
- Erstellen Sie eine Instanz des ATF_BundleProcessor und registrieren Sie die Handler für die Anwendungsfälle, die Sie erweitern möchten:
atf_processor = ATF_BundleProcessor(sender, source)
atf_processor.register_use_case_handler(
"https://gematik.de/fhir/atf/CodeSystem/operation-identifier-cs",
"eRezept_Rezeptanforderung;Rezeptanfrage",
eRezept_Rezeptanforderung_RezeptanfrageHandler()
)
atf_processor.register_use_case_handler(
"https://gematik.de/fhir/atf/CodeSystem/service-identifier-cs",
"eRezept_Rezeptanforderung;Rezeptanfrage_Storno",
eRezept_Rezeptanforderung_Rezeptanfrage_StornoHandler()
)
- Events
Abonnieren Sie das 'message_to_send_event', um die generierten ausgehenden Eingangsbestätigungen zu erhalten und weiterzuleiten:
from app_transport_framework_library.models.message_to_send import MessageToSend
def on_message_to_send_triggered(message_to_send: MessageToSend):
# Senden der Empfangsbestätigung an den ursprünglichen Absender
pass
atf_processor.message_to_send_event.subscribe(on_message_to_send_triggered)
Abonnieren Sie das 'received_Empfangsbestaetigung_event', um die eingehenden Eingangsbestätigungen des belieferten Adressaten zu erhalten und die Message-ID der gesendeten Nachricht auszuwerten:
from app_transport_framework_library.models.empfangsbestaetigung import Empfangsbestaetigung
def on_received_Empfangsbestaetigung(empfangsbestaetigung: Empfangsbestaetigung):
print(f"'{receiver_address}' hat Empfangsbestätigung für '{empfangsbestaetigung.message_id}' von '{empfangsbestaetigung.sender}' erhalten")
atf_processor.received_Empfangsbestaetigung_event.subscribe(on_received_Empfangsbestaetigung)
Abonnieren Sie das 'focus_Ressource_to_process_event', um die inhaltlichen Ressourcen des Anwendungsfalls zu erhalten und auswerten zu können:
from app_transport_framework_library.models.bundle_focus_content import BundleFocusContent
from fhir.resources.R4B.communication import Communication
def on_focus_Ressource_to_process(bundle_content: BundleFocusContent):
from app_transport_framework_library.models.bundle_focus_content import BundleFocusContent
from fhir.resources.R4B.communication import Communication
def on_focus_Ressource_to_process(bundle_content: BundleFocusContent):
print(f"Verarbeitung des Bundles mit Fokus auf '{bundle_content.code}'")
if bundle_content.code == "Selbsttest;Lieferung":
com_parsed = Communication.parse_raw(bundle_content.bundle_entries[0].json())
decoded_message = base64.b64decode(com_parsed.payload[0].contentAttachment.data)
print(f"Das Bundle enthält {len(bundle_content.bundle_entries)} Einträge")
print(f"Die Kommunikation enthält die Payload '{decoded_message.decode('utf-8')}'")
atf_processor.focus_Ressource_to_process_event.subscribe(on_focus_Ressource_to_process)
Beispielimplementierung
Eine Beispielimplementierung kann hier eingesehen werden: https://github.com/gematik/api-app-transport-framework/tree/main/src/poc
Lizenz
Dieses Projekt steht unter der MIT-Lizenz - siehe die LICENSE-Datei für Details.
Metadata
Release files for app-transport-framework-library 0.1.12
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 | |
|---|---|---|---|---|
| app_transport_framework_library-0.1.12.tar.gz | 8.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| app_transport_framework_library-0.1.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.3 kB
Release files / app_transport_framework_library-0.1.12.tar.gz
| Download URL | app_transport_framework_library-0.1.12.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5fd8e347b4b8375ae0e0ff2ab3561c504849af0b3bdc8eb2c51b007acb6892b
|
|
BLAKE2b-256 checksum How to use checksums |
70924e7151f7b86fc7e6fcc8ed92da05d25d14c007f7d789ea202d7a60d3928e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.1 CPython/3.11.6 Linux/6.5.0-21-generic
|
Release files / app_transport_framework_library-0.1.12-py3-none-any.whl
| Download URL | app_transport_framework_library-0.1.12-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4833f01b3c4baae7eb5c763ae1ce0044e538a58ac4cf00155e69ee26e257c9de
|
|
BLAKE2b-256 checksum How to use checksums |
ba70e792aa4c8e24b352e28a7b77fe4ba4def281ad2cfe9d507e8829d73ea4bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.1 CPython/3.11.6 Linux/6.5.0-21-generic
|
Security for app-transport-framework-library 0.1.12
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.