julia> using FHIRClientJSON
julia> base_url = FHIRClientJSON.BaseURL("https://hapi.fhir.org/baseR4")
FHIRClientJSON.BaseURL(URI("https://hapi.fhir.org/baseR4"))
julia> auth = FHIRClientJSON.AnonymousAuth()
FHIRClientJSON.AnonymousAuth()
julia> client = FHIRClientJSON.Client(base_url, auth)
FHIRClientJSON.Client{FHIRClientJSON.AnonymousAuth}(FHIRClientJSON.BaseURL(URI("https://hapi.fhir.org/baseR4")), FHIRClientJSON.AnonymousAuth())
julia> bundle = FHIRClientJSON.request(client, "GET", "/Patient?given=Jason&family=Argonaut")
JSON3.Object{Base.CodeUnits{UInt8,String},Array{UInt64,1}} with 7 entries:
:resourceType => "Bundle"
:id => "f8ccf0ec-0cd1-4d86-83fb-c86d11813715"
:meta => {…
:type => "searchset"
:total => 1
:link => JSON3.Object[{…
:entry => JSON3.Object[{…
julia> patients = bundle.entry;
julia> patient_id = patients[1].resource.id
"1476056"
julia> patient = FHIRClientJSON.request(client, "GET", "/Patient/$(patient_id)")
JSON3.Object{Base.CodeUnits{UInt8,String},Array{UInt64,1}} with 15 entries:
:resourceType => "Patient"
:id => "1476056"
:meta => {…
:text => {…
:extension => JSON3.Object[{…
:identifier => JSON3.Object[{…
:active => true
:name => JSON3.Object[{…
:telecom => JSON3.Object[{…
:gender => "male"
:birthDate => "1985-08-01"
:deceasedBoolean => false
:address => JSON3.Object[{…
:maritalStatus => {…
:communication => JSON3.Object[{…
julia> patient.name
1-element JSON3.Array{JSON3.Object,Base.CodeUnits{UInt8,String},SubArray{UInt64,1,Array{UInt64,1},Tuple{UnitRange{Int64}},true}}:
{
"use": "usual",
"text": "Jason Argonaut",
"family": "Argonaut",
"given": [
"Jason"
]
}
julia> patient.address
2-element JSON3.Array{JSON3.Object,Base.CodeUnits{UInt8,String},SubArray{UInt64,1,Array{UInt64,1},Tuple{UnitRange{Int64}},true}}:
{
"use": "home",
"line": [
"1979 Milky Way Dr."
],
"city": "Verona",
"state": "WI",
"postalCode": "53593",
"country": "US"
}
{
"use": "temp",
"line": [
"5301 Tokay Blvd"
],
"city": "MADISON",
"state": "WI",
"postalCode": "53711",
"country": "US",
"period": {
"start": "2011-08-04T00:00:00Z",
"end": "2014-08-04T00:00:00Z"
}
}