About data models

About data models

This section gives you an overview of data models used by the iOS SDK. The smallest unit of data that can be stored and referenced by the data4life platform is called a record. A record contains the following:

  • Payload of either medical data in the form of an encrypted FHIR resource (Fast Healthcare Interoperability Resources) or generic data

  • Metadata that’s needed to properly associate a record with a user

  • Annotations Custom tags saved as strings that the user can use in order to filter or identify the existing resources. These cannot contain empty strings, and uppercased characters will be always lowercased, due to some internal functionality, so it’s recommended to use lowercased ones.

A record can contain: 1) anything that can be modeled by a FHIR (STU3 or R4) resource. From a single vital sign measurement, such as body temperature, to a complex document linking to or containing multiple attachments and measuring many megabytes in size. 2) Generic Data (called App Data)

For these two cases we have two types of records:

The FHIRRecord data model

The FhirRecord data model holds resource, metadata and additional metadata. AnyFhirResource is a protocol restricted to Data4LifeFHIR.DomainResource or ModelsR4.DomainResource type.

struct FhirRecord<R: AnyFhirResource> {
    public var id: String
    public var fhirResource: R
    public var metadata: Metadata
    public var annotations: [String]
}

The AppDataRecord data model

The AppDataRecord data model like the FHIR one holds resource, metadata and additional metadata.

struct AppDataRecord {
    public var id: String
    public var data: Data
    public var metadata: Metadata
    public var annotations: [String]
}

The Metadata data model

The Metadata data model holds read-only information about records.

struct Metadata {
    var updatedDate: Date
    var createdDate: Date
    var status: Status // can be active, pending, or deleted
}

With your consent, we will analyze your behaviour on the website to improve the website for all users. If you consent to the transmission of analysis data, click “Accept”. You can use the website without giving consent to analyze your behaviour. For further information, visit the privacy policy.