Client
module from Sero. We're also going to be using a library called Chalk
to print information about our queries.baseUrl
of the FHIR API and destructuring the operations we will use (searchType
and read
). Then, we make a search for Humana's InsurancePlan
resources. We use async
and call next
because Sero generates yields paginated results for searches through an iterator and a generator function.PractitionerRole
, which is a FHIR Resource that defines specializations.searchType
operation accepts a object as a second argument and automatically URI encodes the values to generate the API request. We're using quotes around the "speciality:text"
key because :
cannot be used in a symbol.next()
to return the first page of results. From the results, we try to find an eligible Practitioner
(Hematologist).Practitioner
in step 2, we can make a query to retrieve their individual information including NPI:chalk
to log our queries and the final result to console.