Examples

Basic example

julia> using FHIRClient

julia> using FHIRClient.R4Types

julia> fhir_version = FHIRClient.R4()
FHIRClient.R4()

julia> base_url = FHIRClient.BaseURL("https://hapi.fhir.org/baseR4")
FHIRClient.BaseURL(URI("https://hapi.fhir.org/baseR4"))

julia> auth = FHIRClient.AnonymousAuth()
FHIRClient.AnonymousAuth()

julia> client = FHIRClient.Client(fhir_version, base_url, auth)
FHIRClient.Client{FHIRClient.R4, FHIRClient.AnonymousAuth}(FHIRClient.R4(), FHIRClient.BaseURL(URI("https://hapi.fhir.org/baseR4")), FHIRClient.AnonymousAuth())

julia> request_path = "/Patient/1476056"
"/Patient/1476056"

julia> p = FHIRClient.request(Patient, client, "GET", request_path)
FHIRClient.R4Types.Patient(nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, true, FHIRClient.R4Types.AbstractAddress[FHIRClient.R4Types.Address(nothing, nothing, nothing, FHIRClient.R4Types.AbstractElement[], nothing, nothing, nothing, nothing, nothing, "Verona", "US", nothing, FHIRClient.R4Types.AbstractExtension[], nothing, ["1979 Milky Way Dr."], nothing, "53593", "WI", nothing, nothing, "home"), FHIRClient.R4Types.Address(nothing, nothing, nothing, FHIRClient.R4Types.AbstractElement[], nothing, nothing, nothing, nothing, nothing, "MADISON", "US", nothing, FHIRClient.R4Types.AbstractExtension[], nothing, ["5301 Tokay Blvd"], FHIRClient.R4Types.Period(nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, FHIRClient.R4Types.FHIRDateTime("\"2011-08-04T00:00:00Z\"")), "53711", "WI", nothing, nothing, "temp")], Dates.Date("1985-08-01"), FHIRClient.R4Types.AbstractPatient_Communication[FHIRClient.R4Types.Patient_Communication(nothing, FHIRClient.R4Types.AbstractExtension[], nothing, FHIRClient.R4Types.CodeableConcept(nothing, FHIRClient.R4Types.AbstractCoding[FHIRClient.R4Types.Coding(nothing, nothing, nothing, nothing, nothing, "en", "English", FHIRClient.R4Types.AbstractExtension[], nothing, "urn:oid:2.16.840.1.113883.6.99", nothing, nothing)], FHIRClient.R4Types.AbstractExtension[], nothing, "English"), FHIRClient.R4Types.AbstractExtension[], true)], FHIRClient.R4Types.AbstractPatient_Contact[], FHIRClient.R4Types.ResourceList[], false, nothing, FHIRClient.R4Types.AbstractExtension[FHIRClient.R4Types.Extension(nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, "http://hl7.org/fhir/StructureDefinition/us-core-race", nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, FHIRClient.R4Types.CodeableConcept(nothing, FHIRClient.R4Types.AbstractCoding[FHIRClient.R4Types.Coding(nothing, nothing, nothing, nothing, nothing, "2028-9", "Asian", FHIRClient.R4Types.AbstractExtension[], nothing, "2.16.840.1.113883.5.104", nothing, nothing)], FHIRClient.R4Types.AbstractExtension[], nothing, "Asian"), nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing), FHIRClient.R4Types.Extension(nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, "http://hl7.org/fhir/StructureDefinition/us-core-ethnicity", nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, FHIRClient.R4Types.CodeableConcept(nothing, FHIRClient.R4Types.AbstractCoding[FHIRClient.R4Types.Coding(nothing, nothing, nothing, nothing, nothing, "2186-5", "Not Hispanic or Latino", FHIRClient.R4Types.AbstractExtension[], nothing, "2.16.840.1.113883.5.50", nothing, nothing)], FHIRClient.R4Types.AbstractExtension[], nothing, "Not Hispanic or Latino"), nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing), FHIRClient.R4Types.Extension(nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, "http://hl7.org/fhir/StructureDefinition/us-core-birth-sex", nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, FHIRClient.R4Types.CodeableConcept(nothing, FHIRClient.R4Types.AbstractCoding[FHIRClient.R4Types.Coding(nothing, nothing, nothing, nothing, nothing, "M", "Male", FHIRClient.R4Types.AbstractExtension[], nothing, "http://hl7.org/fhir/v3/AdministrativeGender", nothing, nothing)], FHIRClient.R4Types.AbstractExtension[], nothing, "Male"), nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing)], "male", FHIRClient.R4Types.AbstractReference[], "1476056", FHIRClient.R4Types.AbstractIdentifier[FHIRClient.R4Types.Identifier(nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, nothing, "urn:oid:1.2.840.114350.1.13.327.1.7.5.737384.0", nothing, "usual", "E3826"), FHIRClient.R4Types.Identifier(nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, nothing, "urn:oid:1.2.3.4", nothing, "usual", "203579")], nothing, nothing, FHIRClient.R4Types.AbstractPatient_Link[], nothing, FHIRClient.R4Types.CodeableConcept(nothing, FHIRClient.R4Types.AbstractCoding[FHIRClient.R4Types.Coding(nothing, nothing, nothing, nothing, nothing, "S", "Never Married", FHIRClient.R4Types.AbstractExtension[], nothing, "http://hl7.org/fhir/ValueSet/marital-status", nothing, nothing)], FHIRClient.R4Types.AbstractExtension[], nothing, "Single"), FHIRClient.R4Types.Meta(nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, TimeZones.ZonedDateTime(2020, 9, 21, 16, 26, 42, 55, tz"UTC"), String[], FHIRClient.R4Types.AbstractCoding[], "#BkkjG8tIAryKje9w", FHIRClient.R4Types.AbstractCoding[FHIRClient.R4Types.Coding(nothing, nothing, nothing, nothing, nothing, "MR", nothing, FHIRClient.R4Types.AbstractExtension[], nothing, "http://hl7.org/fhir/v2/0203", nothing, nothing)], "1"), FHIRClient.R4Types.AbstractExtension[], nothing, nothing, FHIRClient.R4Types.AbstractHumanName[FHIRClient.R4Types.HumanName(nothing, FHIRClient.R4Types.AbstractElement[], FHIRClient.R4Types.AbstractElement[], FHIRClient.R4Types.AbstractElement[], nothing, nothing, FHIRClient.R4Types.AbstractExtension[], "Argonaut", ["Jason"], nothing, nothing, String[], String[], "Jason Argonaut", "usual")], FHIRClient.R4Types.AbstractAttachment[], "Patient", FHIRClient.R4Types.AbstractContactPoint[FHIRClient.R4Types.ContactPoint(nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, nothing, nothing, "phone", "home", "608-271-9000"), FHIRClient.R4Types.ContactPoint(nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, nothing, nothing, "phone", "work", "608-771-9000"), FHIRClient.R4Types.ContactPoint(nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, nothing, nothing, "phone", "mobile", "608-771-9000"), FHIRClient.R4Types.ContactPoint(nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, nothing, nothing, "fax", "home", "608-771-9000"), FHIRClient.R4Types.ContactPoint(nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, FHIRClient.R4Types.Period(nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, FHIRClient.R4Types.FHIRDateTime("\"2011-08-04T00:00:00Z\"")), nothing, "phone", "temp", "608-771-9000"), FHIRClient.R4Types.ContactPoint(nothing, nothing, nothing, nothing, FHIRClient.R4Types.AbstractExtension[], nothing, nothing, nothing, "email", nothing, "open@epic.com")], FHIRClient.R4Types.Narrative(nothing, "<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">Jason <b>ARGONAUT </b></div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>E3826</td></tr><tr><td>Address</td><td><span>1979 Milky Way Dr. </span><br/><span>Verona </span><span>WI </span><span>US </span></td></tr><tr><td>Date of birth</td><td><span>01 August 1985</span></td></tr></tbody></table></div>", FHIRClient.R4Types.AbstractExtension[], nothing, "generated"))

julia> typeof(p)
FHIRClient.R4Types.Patient

julia> fieldnames(Patient)
(:_active, :_birthDate, :_deceasedBoolean, :_deceasedDateTime, :_gender, :_implicitRules, :_language, :_multipleBirthBoolean, :_multipleBirthInteger, :active, :address, :birthDate, :communication, :contact, :contained, :deceasedBoolean, :deceasedDateTime, :extension, :gender, :generalPractitioner, :id, :identifier, :implicitRules, :language, :link, :managingOrganization, :maritalStatus, :meta, :modifierExtension, :multipleBirthBoolean, :multipleBirthInteger, :name, :photo, :resourceType, :telecom, :text)

julia> p.name
1-element Vector{FHIRClient.R4Types.AbstractHumanName}:
 FHIRClient.R4Types.HumanName(nothing, FHIRClient.R4Types.AbstractElement[], FHIRClient.R4Types.AbstractElement[], FHIRClient.R4Types.AbstractElement[], nothing, nothing, FHIRClient.R4Types.AbstractExtension[], "Argonaut", ["Jason"], nothing, nothing, String[], String[], "Jason Argonaut", "usual")