Python connector for the IntaOps SMART-on-FHIR R4 network
Project description
IntaOps Connector — Python
Drop-in Python SDK for the IntaOps SMART-on-FHIR R4 network.
pip install intaops
Backend (system-to-system)
from intaops import IntaOpsClient
client = IntaOpsClient(
client_id="app_live_…",
client_secret="secret_live_…",
environment="live", # or "sandbox"
scopes=["system/Patient.read", "system/Observation.read"],
)
patient = client.fhir.get("Patient", "u123")
for obs in client.fhir.search_iter("Observation", patient="u123"):
print(obs["valueQuantity"]["value"])
Provider / patient app (SMART user grant)
from intaops import IntaOpsClient
# Step 1 — generate PKCE + redirect the user
pkce = IntaOpsClient.generate_pkce()
client = IntaOpsClient(
client_id="app_live_…", environment="live",
scopes=["patient/Observation.read", "patient/MedicationRequest.read"],
)
url = client.authorize_url(
redirect_uri="https://yourapp.com/cb",
code_challenge=pkce.challenge,
)
# … redirect the user to `url`, capture `code` on the callback …
# Step 2 — exchange the code for tokens
client = IntaOpsClient.from_authorization_code(
code=code_from_callback,
redirect_uri="https://yourapp.com/cb",
code_verifier=pkce.verifier,
client_id="app_live_…",
environment="live",
scopes=["patient/Observation.read", "patient/MedicationRequest.read"],
)
obs = client.fhir.get("Observation", "obs-1")
Errors
from intaops import (
IntaOpsError, OAuthError, OperationOutcomeError,
ConsentRequiredError, RateLimitedError,
)
try:
client.fhir.get("Observation", "obs-1")
except ConsentRequiredError as e:
# Send the deep-link to the user via push, email, or your in-app channel.
notify_user(e.user_id, e.consent_url)
except RateLimitedError as e:
time.sleep(e.retry_after or 30)
except OperationOutcomeError as e:
log(e.status_code, e.issue_code, e.location, e.outcome)
except OAuthError as e:
refresh_credentials(e.error)
API
IntaOpsClient(client_id, client_secret=, environment=, scopes=)IntaOpsClient.from_authorization_code(code, redirect_uri, code_verifier, …)IntaOpsClient.generate_pkce()→PKCEPairIntaOpsClient.authorize_url(redirect_uri, code_challenge, state=)→ strclient.fhir.get(resource_type, resource_id)→ dictclient.fhir.search(resource_type, **params)→ Bundle dictclient.fhir.search_iter(resource_type, **params)→ iterator of resourcesclient.fhir.create(resource_type, resource)→ dictclient.fhir.update(resource_type, resource_id, resource)→ dictclient.fhir.capability_statement()→ dict
License
Apache-2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
intaops-0.1.0.tar.gz
(17.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
intaops-0.1.0-py3-none-any.whl
(20.2 kB
view details)
File details
Details for the file intaops-0.1.0.tar.gz.
File metadata
- Download URL: intaops-0.1.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1efe8a64c92d70179332f84616559e8ae84057f2054894d899efae949d7e17ce
|
|
| MD5 |
e44e5b766d031191ffe632cc9309d213
|
|
| BLAKE2b-256 |
67f41c6413a3828076bc75198dc68b1e2b79d745c850431e1a740f68fdfafa5e
|
File details
Details for the file intaops-0.1.0-py3-none-any.whl.
File metadata
- Download URL: intaops-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f329e5f02f758718cbaf20c08a231c6a78b9aeca46feb4451a0bde1bcf9e524b
|
|
| MD5 |
6756f4111f9dbc0a10937cafce2fb402
|
|
| BLAKE2b-256 |
2b85d5165d9cf435b3d2e7ff9aba7f8e5de23506c6948bba5d1940c4469a745b
|