Repository navigation
feat: pharmacy views, a HealthcareService search helper that sends both includes, and outcomes() - #99
Open
briankfung wants to merge 5 commits into
Open
briankfung wants to merge 5 commits into
briankfung wants to merge 5 commits into
Conversation
…ludes, and outcomes() pharmacy_views() reads one page of a HealthcareService search into one row per matched service, a frozen dataclass: the NPI, name, address, phone, whether it is active and its NUCC codes, read from the service and the Organization and store the page holds for it; what Medicare Part D says of it, from haau3's Part D Listing extension, as a PartDListing; the networks NDH's Network Reference extension names, each a PharmacyNetwork with a Part D network's plan and kind read from its documented id, and whether the plan prefers it; and the three FHIR resources as the API served them. A pharmacy that names an Organization or Location the page does not hold raises, naming the helper, when the page's self link shows a pharmacy search that did not ask for that include, or the page has no self link. A page that holds the record where FHIR's rules for a Bundle do not find it from the reference raises, saying so. Anything else is left out: a target of another type, a record a search asked for and the page still lacks, and whatever a service that is not a pharmacy, or a page from the directory's own search, names and the page does not hold. A value of another shape than FHIR gives it is read as absent. search_healthcare_service_with_includes() is generated beside the Slot and Schedule helpers, on both clients and on with_response: it sends _include=HealthcareService:organization and _include=HealthcareService:location, and takes every keyword of search_healthcare_service() but include. The generator now writes a helper for a search that takes no _include:iterate. outcomes() reads a search page's own OperationOutcomes, the entries whose search mode is outcome, for any search. The README gains a "Pharmacies" section, and "Paging" points to outcomes(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… outcomes() The spec's own example answer read into rows, and served by a FastAPI route; each plain value and its fallback, blank values among them; the Part D listing as served, absent, or with a part missing or of another type; each network's plan and kind from a Part D id, another network with neither, a name from a later reference, and a reference naming no Organization left out; preferred's three answers; the raise read from the page's self link, a record held where FHIR's rules do not find it, a reference to another type, and pages from the directory's own search; contained, wrong-typed and ambiguous references, and values of another shape than FHIR gives them; rows frozen, compared by value and never hashed; outcomes() reading only the entries whose search mode is outcome; and the helper sending both includes and nothing else, on both clients and with_response, refusing include. The customer's type check covers the new names. Each test was proved by breaking the code it covers, 28 ways, each caught. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lper takes no summary The patterns that read a reference's type and id, and a network's Organization id, are anchored at the end of the reference, so an absolute reference on a server whose path has a capitalised segment before the type (`/api/FHIR/R4/Organization/O1`) is read by its last type and id, as the TypeScript SDK reads it. It was read as having no type, which raised where the record is left out, and missed the error for a record held where FHIR's rules for a Bundle do not find it. search_healthcare_service_with_includes() takes no summary: the API does not combine _summary with an include, and the helper always sends one, so a call with summary could never succeed. The generator leaves a helper's left-out parameters out of its keywords and its query, and stops when a search no longer takes one. A self link whose port is out of range is not read as a URL, as a URL parser does not read it. The error for a record held where FHIR's rules do not find it names the version a reference names. outcomes() is defined under the name the package exports. The clients' pharmacy_views() docstrings name every error, and the README's Paging sentence is rewrapped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
briankfung
force-pushed
the
pharmacy-views
branch
from
December 2, 2026 02:29
eb5d4cd to
548d916
Compare
An absolute reference on a server whose path has a capitalised segment, read for a held Organization and for one of another type; a network on such a server; a version the page does not hold; a page holding a resource of another type with the id a reference names; a blank reference; both includes asked for in one comma-separated value of the self link, and a self link with a port out of range; a network's first name kept when a later reference gives another, and an id with more after the kind; summary refused, with nothing sent; the helper's keywords and query less include and summary, and the generator stopping on a left-out parameter its search does not take; and outcomes() named as the package exports it. Each was proved by breaking the code it covers, 9 ways, each caught. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
briankfung
force-pushed
the
pharmacy-views
branch
from
December 2, 2026 02:34
1a65df1 to
db34eca
Compare
…isting, a part repeated, and a type name with something before it Cases another SDK's review found the suites shared no test for, each proved to fail without the code it covers: when the store and the Organization both have an address, the store's; of two whole Part D listings, the first; a listing whose first listed part is not a boolean is unknown though a later one is; and a reference whose type name has something before it is taken as having no type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
briankfung
marked this pull request as ready for review
December 2, 2026 02:40
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three additions for the pharmacy search, on the same footing as the slot and schedule views.
What it adds
pharmacy_views(page), a client method on both clients and a plain function. It reads one page of aHealthcareServicesearch into one row per matched service, a frozen dataclasshaau3.PharmacyView:npi,name,address(a FHIRAddress),phone,activeandspecialties(NUCC codings), read from the service and theOrganizationand storeLocationthe page holds for it;part_dis ahaau3.PartDListing(listed,as_of,contract_year), andNonemeans not known, never not listed;networks, each ahaau3.PharmacyNetworkwith a Part D network'splanandkindread from its documented id, andpreferred(True, False, orNonewhen no Part D network is named);service,organization,locations.search_healthcare_service_with_includes(), generated beside the Slot and Schedule helpers, on both clients and onwith_response. It sends_include=HealthcareService:organizationand_include=HealthcareService:location, and takes every keyword ofsearch_healthcare_service()butincludeandsummary, which Python refuses before anything is sent. The API does not combine_summarywith an include, so a call with it could never succeed. The generator now writes a helper for a search that takes no_include:iterate, and leaves out the parameters a helper names inLEAVES_OUT.outcomes(page), a client method on both clients and a plain function, reads a search page's ownOperationOutcomes: the entries whose search mode isoutcome, whichmatches()leaves out. A pharmacy search answers one when a Part D plan lists no pharmacy of the network's kind, and one when Part D's files could not be read.pharmacy_views()raises aHaau3Errorin three cases:OrganizationorLocationthe page does not hold, on a pharmacy search that did not ask for that include. The error names the helper. The page'sselflink says what the search asked for, and a page without one is read as a search that asked for nothing.Anything else is left out:
A value of another shape than FHIR gives it is read as absent.
The README gains a "Pharmacies" section with the field table, and "Paging" now points to
outcomes().Tests
tests/test_pharmacy_views.py, 68 tests:preferred's three answers;selflink, and where it does not apply;outcomes();with_response.tests/typecheck/consumer.pycovers the new names.Checked
generate.py --check, ruff, ruff format, mypy and pyright (strict) over the sources, tests and README blocks,pyright --verifytypes(100%),uv buildwithcheck_package.py, and the customer type check on Python 3.10.pytest: 1440 passed, on the spec at preview.45.🤖 Generated with Claude Code