This file contains 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
struct Person:Codable { | |
let display: String? | |
let reference: String | |
} | |
struct CodeableConcept:Codable { | |
let text:String | |
let coding:[[String:String]] | |
} |
This file contains 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
// MARK: VitalSign | |
struct VitalSign:Codable { | |
let id: String | |
let resourceType:String | |
let category:CodeableConcept | |
let code:CodeableConcept | |
let status:String | |
let encounter:[String: String] |
This file contains 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
// MARK: Procedure | |
struct Procedure:Codable { | |
let id: String | |
let resourceType:String | |
let code:CodeableConcept | |
let status:String | |
let encounter:[String: String] | |
let performedDateTime:String |
This file contains 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
// MARK: Medication | |
struct DosageInstruction: Codable { | |
let text:String? | |
let timing:[String:[String:String?]?]? | |
} | |
struct Medication:Codable { | |
let dateWritten:String | |
let status: String |
This file contains 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
// MARK: LabResult | |
struct ReferenceRange:Codable { | |
let low:ValueQuantity | |
let high:ValueQuantity | |
let text:String | |
} | |
struct ValueQuantity:Codable { |
This file contains 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
// MARK: Immunization | |
struct Immunization:Codable { | |
let id: String | |
let resourceType:String | |
let vaccineCode:CodeableConcept | |
let encounter:[String: String] | |
let requester:[String: String] | |
let date: String |
This file contains 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
// MARK: Condition | |
struct Condition:Codable { | |
let id: String | |
let resourceType:String | |
let asserter:Person | |
let category:[String: [[String: String]]] | |
let clinicalStatus: String | |
let code: CodeableConcept |
This file contains 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
// MARK: Allergy | |
struct Reaction:Codable { | |
let onset:String? | |
let manifestation:[[String: String]] | |
let severity:String | |
} | |
struct Allergy: Codable { | |
let id: String |
This file contains 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
func getRecordForType(type: HKClinicalTypeIdentifier, recordReadCompletionHandler:@escaping ([HKClinicalRecord]?) -> Void) { | |
guard let healthRecordType = HKObjectType.clinicalType(forIdentifier: type) else { | |
fatalError("*** Unable to create the record type ***") | |
} | |
let healthRecordQuery = HKSampleQuery(sampleType: healthRecordType, predicate: nil, limit: HKObjectQueryNoLimit, sortDescriptors: nil) { (query, samples, error) in | |
guard let actualSamples = samples else { |
This file contains 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
func getRecordUsingPredicateForAllergyType(recordReadCompletionHandler:@escaping ([HKClinicalRecord]?) -> Void) { | |
guard let healthRecordAllergyType = HKObjectType.clinicalType(forIdentifier: .allergyRecord) else { | |
fatalError("*** Unable to create the Allergy type ***") | |
} | |
let healthRecordPredicate = HKQuery.predicateForClinicalRecords(withFHIRResourceType: .allergyIntolerance) | |
NewerOlder