Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# API reference

Every operation of the haau3 platform API (`1.0.0-preview.45`) is a method on `Haau3` and on
Every operation of the haau3 platform API (`1.0.0-preview.49`) is a method on `Haau3` and on
`AsyncHaau3`, named by its operationId in snake_case. Each links to its page on docs.haau3.com, which
shows its parameters and an example exchange. Path values come first, then `body` for an operation
that takes one, and the query parameters are keyword arguments named by the API's own names in
Expand All @@ -14,8 +14,8 @@ An operation that declares a header takes it as one more keyword, named from the
checked before sending: `process_message` takes `payer_authorization`, sent as `Payer-Authorization`; `sandbox_process_message` takes `payer_authorization`, sent as `Payer-Authorization`.

`batch()` sends several of these as one request, each with its own answer or error, from the entries
`haau3.calls` makes. It takes every operation on the FHIR base except `fhir_batch`, `process_message` and `reconcile_medications`: 34 of the
39. See the README's "Several requests in one".
`haau3.calls` makes. It takes every operation on the FHIR base except `fhir_batch`, `process_message` and `reconcile_medications`: 38 of the
43. See the README's "Several requests in one".

## FHIR base

Expand Down Expand Up @@ -84,7 +84,7 @@ FHIR Questionnaire, served as its source publishes it. This service holds copies

## Medical Benefits

FHIR InsurancePlan: what a Medicare Advantage or ACA Marketplace plan covers and what a member pays, read from the files CMS publishes. Every plan names the CMS release it was read from. Read a plan by its id, or search by identifier, name, state or county, and check whether the CMS National Provider Directory lists providers in a plan's network.
FHIR InsurancePlan: what a Medicare Advantage or ACA Marketplace plan covers and what a member pays, read from the files CMS publishes. Every plan names the CMS release it was read from. Read a plan by its id, or search by identifier, name, state or county, and check whether the CMS National Provider Directory lists providers in a plan's network. A Medicare Part D formulary and a Part D plan's drug plan are InsurancePlans too, read on the same path by their own forms of id, and counted as Pharmacy Benefits.

| Method | Request | What it does |
|---|---|---|
Expand All @@ -95,11 +95,15 @@ FHIR InsurancePlan: what a Medicare Advantage or ACA Marketplace plan covers and

## Pharmacy Benefits

The CARIN Consumer Real-Time Pharmacy Benefit Check as FHIR messaging: what a medication would cost a member under their coverage, or its price at pharmacies near a ZIP code, in real time, from the sources this service connects to. A member's request receives patient data, so send it only under an executed agreement.
The CARIN Consumer Real-Time Pharmacy Benefit Check as FHIR messaging: what a medication would cost a member under their coverage, or its price at pharmacies near a ZIP code, in real time, from the sources this service connects to. A member's request receives patient data, so send it only under an executed agreement. And Medicare Part D from CMS's monthly file, in the shape of HL7's Da Vinci US Drug Formulary guide: which drugs each formulary lists, at which tier and with which limits, and each plan's drug plan, with what each tier costs.

| Method | Request | What it does |
|---|---|---|
| [`process_message(body)`](https://docs.haau3.com/api-reference/pharmacy-benefits/check-what-a-medication-costs-pharmacy-benefit-check) | `POST /v1/fhir/r4/$process-message` | Check what a medication costs (pharmacy benefit check) |
| [`search_basic(**query)`](https://docs.haau3.com/api-reference/pharmacy-benefits/find-drugs-on-a-part-d-formulary) | `GET /v1/fhir/r4/Basic` | Find drugs on a Part D formulary |
| [`read_basic(id)`](https://docs.haau3.com/api-reference/pharmacy-benefits/read-a-drug-on-a-part-d-formulary) | `GET /v1/fhir/r4/Basic/{id}` | Read a drug on a Part D formulary |
| [`search_medication_knowledge(**query)`](https://docs.haau3.com/api-reference/pharmacy-benefits/find-drugs-any-part-d-formulary-lists) | `GET /v1/fhir/r4/MedicationKnowledge` | Find drugs any Part D formulary lists |
| [`read_medication_knowledge(id)`](https://docs.haau3.com/api-reference/pharmacy-benefits/read-a-drug-a-part-d-formulary-lists) | `GET /v1/fhir/r4/MedicationKnowledge/{id}` | Read a drug a Part D formulary lists |

## MedList

Expand Down
50 changes: 49 additions & 1 deletion openapi/code-samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"overlay": "1.2.0",
"info": {
"title": "Python samples for every operation of the haau3 platform API",
"version": "1.0.0-preview.45"
"version": "1.0.0-preview.49"
},
"extends": "https://api.haau3.com/openapi.json",
"actions": [
Expand Down Expand Up @@ -426,6 +426,54 @@
]
}
},
{
"target": "$.paths['/v1/fhir/r4/Basic'].get",
"update": {
"x-codeSamples": [
{
"lang": "python",
"label": "Python",
"source": "from haau3 import Haau3\n\nclient = Haau3() # reads HAAU3_API_KEY\nbundle = client.search_basic(\n formulary=\"InsurancePlan/Formulary-00027002\",\n subject=\"MedicationKnowledge/FormularyDrug-311354\",\n include=[\"Basic:formulary\", \"Basic:subject\"],\n)\nprint(len(bundle.get(\"entry\", [])))\n"
}
]
}
},
{
"target": "$.paths['/v1/fhir/r4/Basic/{id}'].get",
"update": {
"x-codeSamples": [
{
"lang": "python",
"label": "Python",
"source": "from haau3 import Haau3\n\nclient = Haau3() # reads HAAU3_API_KEY\nbasic = client.read_basic(\"FormularyItem-00027002-311354\")\nprint(basic.get(\"id\"))\n"
}
]
}
},
{
"target": "$.paths['/v1/fhir/r4/MedicationKnowledge'].get",
"update": {
"x-codeSamples": [
{
"lang": "python",
"label": "Python",
"source": "from haau3 import Haau3\n\nclient = Haau3() # reads HAAU3_API_KEY\nbundle = client.search_medication_knowledge(code=\"311354\")\nprint(len(bundle.get(\"entry\", [])))\n"
}
]
}
},
{
"target": "$.paths['/v1/fhir/r4/MedicationKnowledge/{id}'].get",
"update": {
"x-codeSamples": [
{
"lang": "python",
"label": "Python",
"source": "from haau3 import Haau3\n\nclient = Haau3() # reads HAAU3_API_KEY\nmedication_knowledge = client.read_medication_knowledge(\"FormularyDrug-311354\")\nprint(medication_knowledge.get(\"id\"))\n"
}
]
}
},
{
"target": "$.paths['/v1/fhir/r4/$reconcile-medications'].post",
"update": {
Expand Down
2 changes: 1 addition & 1 deletion openapi/etag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"83HSBqGwyWwwJnD6q4HBw0zMkgS"
"hmZgQzhF6A5yXJa9YWqeFMkVn4i"
2,412 changes: 1,912 additions & 500 deletions openapi/openapi.json

Large diffs are not rendered by default.

24 changes: 20 additions & 4 deletions src/haau3/_bundle_reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
from ._bundles import matches_in, resolve_in


@overload
def resolve(
bundle: fhir.Bundle,
reference: fhir.Reference | str | None,
*,
type: Literal["Basic"],
from_: fhir.Resource | None = None,
) -> fhir.Basic | None: ...
@overload
def resolve(
bundle: fhir.Bundle,
Expand Down Expand Up @@ -87,6 +95,14 @@ def resolve(
from_: fhir.Resource | None = None,
) -> fhir.Medication | None: ...
@overload
def resolve(
bundle: fhir.Bundle,
reference: fhir.Reference | str | None,
*,
type: Literal["MedicationKnowledge"],
from_: fhir.Resource | None = None,
) -> fhir.MedicationKnowledge | None: ...
@overload
def resolve(
bundle: fhir.Bundle,
reference: fhir.Reference | str | None,
Expand Down Expand Up @@ -219,7 +235,6 @@ def resolve(
"Appointment",
"AppointmentResponse",
"AuditEvent",
"Basic",
"Binary",
"BiologicallyDerivedProduct",
"BodyStructure",
Expand Down Expand Up @@ -280,7 +295,6 @@ def resolve(
"Media",
"MedicationAdministration",
"MedicationDispense",
"MedicationKnowledge",
"MedicinalProduct",
"MedicinalProductAuthorization",
"MedicinalProductContraindication",
Expand Down Expand Up @@ -364,6 +378,8 @@ def resolve(
return resolve_in(bundle, reference, type=type, from_=from_)


@overload
def matches(page: fhir.Bundle, type: Literal["Basic"]) -> list[fhir.Basic]: ...
@overload
def matches(page: fhir.Bundle, type: Literal["Bundle"]) -> list[fhir.Bundle]: ...
@overload
Expand All @@ -383,6 +399,8 @@ def matches(page: fhir.Bundle, type: Literal["Location"]) -> list[fhir.Location]
@overload
def matches(page: fhir.Bundle, type: Literal["Medication"]) -> list[fhir.Medication]: ...
@overload
def matches(page: fhir.Bundle, type: Literal["MedicationKnowledge"]) -> list[fhir.MedicationKnowledge]: ...
@overload
def matches(page: fhir.Bundle, type: Literal["MedicationRequest"]) -> list[fhir.MedicationRequest]: ...
@overload
def matches(page: fhir.Bundle, type: Literal["MedicationStatement"]) -> list[fhir.MedicationStatement]: ...
Expand Down Expand Up @@ -423,7 +441,6 @@ def matches(
"Appointment",
"AppointmentResponse",
"AuditEvent",
"Basic",
"Binary",
"BiologicallyDerivedProduct",
"BodyStructure",
Expand Down Expand Up @@ -484,7 +501,6 @@ def matches(
"Media",
"MedicationAdministration",
"MedicationDispense",
"MedicationKnowledge",
"MedicinalProduct",
"MedicinalProductAuthorization",
"MedicinalProductContraindication",
Expand Down
Loading
Loading