The haau3 platform API is in preview: it may change as we build, usually to add features or improve performance.
429 or a 5xx, gives typed errors that never print a response body, follows a
FHIR search’s pages, and sends several requests as one batch.
All three are MIT licensed. Each runs on a server only, and refuses to start in a browser, where an
API key would be public. Every operation’s page in the API reference shows its
call in each language beside the curl command. A new operation shows curl alone until the SDKs’
next release.
Install
Authenticate
Create an API key on platform.haau3.com, or from your project’s folder with the haau3 CLI:npx haau3 login, then npx haau3 keys create, which writes it to the
project’s env file without showing it (see Authentication). Each SDK reads it from
HAAU3_API_KEY, or takes it as an option, so the program loads that file when it starts. Make one
client and reuse it: it holds a pool of connections.
AsyncHaau3, with the same methods awaited, on asyncio and on trio.
A first call
@types/fhir’s types in TypeScript (exported
as fhir4), plain dicts typed with TypedDicts from HL7’s R4 schema in Python, and structs
generated from the same schema in Go’s fhir package. FHIR elements are optional, so Python reads them with .get() and Go
holds each as a pointer.
One call per service
api.md lists every method by service, with its request and its page in the API
reference: TypeScript,
Python and
Go.
The Sandbox
The Sandbox,https://sandbox.haau3.com, is the API’s test environment, to build and test against: each
operation answers its documented example request with a fixed answer, and the pharmacy benefit check
is answered by a test insurer with synthetic data. Your key’s mode picks where each SDK sends every
call: a test key (haau3_sk_test_…) to the Sandbox, a live key (haau3_sk_live_…) to production,
so HAAU3_API_KEY alone moves an app from one to the other. With HAAU3_API_KEY unset, name the
Sandbox to call it with no key at all:
/v1/sandbox/fhir/r4, and its two
methods are deprecated: call the pharmacy benefit check and metadata on the Sandbox’s own host
instead. Each README has the details.
Reading a lookup and a validation
A terminology answer is a FHIRParameters resource. Each SDK reads one into a typed object. The
lookup reader (lookupResult(), lookup_result(), Go’s haau3.LookupResult) gives the code, its
system and version, its display, whether it is abstract (not for use, such as an ICD-10-CM
header), every designation and every property. designations() (Go’s haau3.Designations) finds a
code’s names by use and language, and a language matches the way RFC 4647 says, so en finds
en-US. ICD-10-CM’s short title is its synonym designation, where it differs from the display.
validationResult(), validation_result(), Go’s haau3.ValidationResult)
reads a $validate-code answer, from a code system or a value set: the result, the display and the
message. A display that does not match answers false with the code’s own display beside it, which
means the code is valid and only the label differs.
Errors
403 is a
ForbiddenError (KindForbidden in Go), never the key’s error: the key was accepted. Its code
(Code in Go) says why when the API names it: a test key sent outside the Sandbox, or a live key
sent to it (see test and live keys), or patient data from an
organization without a BAA, where a resource is not labelled as test data,
or an operation not yet open to customers (not-open-to-customers). A refused request’s code names
why too, when the API does: the Sandbox’s not-the-example for a request other than an operation’s
example. Both since @haau3/sdk 0.4.2, haau3 0.4.2 and haau3-go v0.3.2.
No answer is never reported as
an empty result, and an empty result is never an error. An error’s message never includes the body the API
answered with, and the body is never printed when the error is logged. A FHIR answer is checked
against the resource types its operation answers with, and anything else is a no-answer error with
the reason unreadable. Errors lists every status the API answers.
A client that cannot be made is refused when it is made, before anything is sent. Its error carries
a code to branch on (Code on Go’s KindNotSent error), and its message names the option or the
variable the value came from:
no-api-key: no key, and the Sandbox not named as the environment.api-key-not-alone: something before the key’shaau3_sk_prefix, such as the quotes an env file kept, orBearer.test-key-outside-sandbox,live-key-in-sandboxandolder-key-in-sandbox: a key of the other environment’s mode, named or reached through the base URL. The first two are the API’s own names.invalid-environment,invalid-base-urlandenvironment-conflicts-with-base-url.invalid-app-info, and each language’s own, which its README lists.
Request ids and timing
Paging
Each SDK follows a FHIR search’snext links on the client’s own host, one page at a time, or one
resource at a time across every page:
next link with no request, and a
search takes it back as page. A cursor belongs to its search: send it with every other parameter
as before, including status and start for a Slot search, whose defaults the API fills in. A Slot,
Schedule or plan search refuses a cursor sent with its search changed (a 400), the provider
directory’s cursors expire, and a plan search answers 410 once the plans are updated.
A value a person typed
Each SDK escapes FHIR’s special characters in a search value (\, ,, $ and | each take a \
before them), so the API reads what a person typed as the one value it is. Unescaped, a comma separates
values the API reads as “or”, so Austin, TX asks for two cities, and a trailing comma is refused with
a 400. Never escape a value you built with , or | on purpose, such as a list of codes or a
system|code token: build a token as the next section shows.
A code to search for
Each SDK turns a coding into the value a token search parameter takes,system|code, each part
escaped, so a code picked from a value set’s expansion goes straight into a search. Given several
codings, it is any of them: their tokens joined by commas. Each needs both a system and a code, or the
SDK refuses it, since a token without its system matches the code in every system. For a code in any
system, send the escaped code alone.
Slots and schedules
A Slot search answers a FHIR Bundle ofSlots, and each Slot’s Schedule, and the Location and
provider the Schedule names, come in the same page when the search asks for them with _include.
Each SDK has a helper that sends every include the Slot search serves, and a slot view that hands you
each matched Slot with what the page holds for it, side by side, each the FHIR resource the API served:
its Schedule, Locations, PractitionerRoles, Practitioners and HealthcareServices, the booking link and
phone, whom it accepts, and whether the place is virtual. A view reads one page with no request, and
the Schedule search has the same pair.
Several requests in one
A batch sends several operations of the FHIR base as one request, and each gets its own result, in the order given:$reconcile-medications and Pharmacy Benefits’ $process-message. Each entry counts toward your plan as a request of its own (limits).
Any operation by its path
get() and post() (Get and Post in Go) call an operation by its path: one this version of the
SDK has no method for yet, or one a tool found in the spec. Each takes the path as the spec writes
it, a value for each {name}, the query, the body (for a post()) and the FHIR types the answer may
be in. They raise the same errors as every operation’s own method, and give the request id and
timing too:
{name} with no value, or a value with no {name}, is refused before anything is sent.
Since @haau3/sdk 0.4.2, haau3 0.4.2 and haau3-go v0.3.2.
Any request
Each SDK sends a request as you give it and returns what the API answered, whatever the status:Options
Each option, and what is used without it:
A call can set its own time and retries too. A retry waits a short, growing interval, or what the
API’s
Retry-After header says when that is 60 seconds or less. A longer one fails at once, carrying it. The API key is sent only to the base URL’s host. Set
HAAU3_BASE_URL to run code you have not changed against a stand-in API of your own.
Frameworks and testing
Each README covers its own language’s frameworks and tests:- TypeScript: any runtime’s
fetchoptions, such as a proxy in Node or Next.js’s caching. - Python: FastAPI, Django and Flask, and testing your code.
- Go: net/http and Gin, and testing your code.
Versions
Each SDK is0.y.z while the API is in preview: a minor release may change what a method takes or
answers, and a patch release never does. Each repository’s CHANGELOG.md lists every release, and
a release that takes a new version of the API’s spec names that version; SPEC_VERSION (Go’s
SpecVersion) is the one a release was generated from.