diff --git a/Package.swift b/Package.swift index 82c0d5d..5a311f2 100644 --- a/Package.swift +++ b/Package.swift @@ -11,17 +11,25 @@ let package = Package( ], products: [ .library(name: "ModelsDSTU2", targets: ["ModelsDSTU2"]), + .library(name: "ModelsSTU3", targets: ["ModelsSTU3"]), .library(name: "ModelsR4", targets: ["ModelsR4"]), .library(name: "ModelsBuild", targets: ["ModelsBuild"]), ], targets: [ .target(name: "FMCore"), .target(name: "ModelsDSTU2", dependencies: ["FMCore"]), + .target(name: "ModelsSTU3", dependencies: ["FMCore"]), .target(name: "ModelsR4", dependencies: ["FMCore"]), .target(name: "ModelsBuild", dependencies: ["FMCore"]), .testTarget(name: "CoreTests", dependencies: ["FMCore"]), .testTarget(name: "DateTimeTests", dependencies: ["ModelsR4"]), - .testTarget(name: "ModelTests", dependencies: ["ModelsR4"]), - .testTarget(name: "PrimitiveTests", dependencies: ["ModelsR4"]), + .testTarget(name: "ModelTests", + dependencies: [ + "ModelsDSTU2", + "ModelsSTU3", + "ModelsR4", + "ModelsBuild", + ]), + .testTarget(name: "PrimitiveTests", dependencies: ["ModelsR4"]), ] ) diff --git a/README.md b/README.md index 76d8b01..9f64ce1 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ FHIRModels ========== -![0.1.0](https://img.shields.io/badge/Latest-0.1.0-blueviolet.svg?style=flat) ![🔥 FHIR DSTU-2, R4, build](https://img.shields.io/badge/🔥_FHIR-DSTU2_•%20R4_•%20β4.4-orange.svg?style=flat) ![Works on macOS, iOS, watchOS and tvOS](https://img.shields.io/badge/Platform-macOS_•%20iOS_•%20watchOS_•%20tvOS-blue.svg?style=flat) [![Swift Package Manager](https://img.shields.io/badge/SPM-compatible-brightgreen.svg?style=flat)][spm] [![License](https://img.shields.io/badge/License-APACHE_2.0-lightgrey.svg?style=flat)](#license) +![0.2.0](https://img.shields.io/badge/Latest-0.2.0-blueviolet.svg?style=flat) ![🔥 FHIR DSTU2, STU3, R4, build](https://img.shields.io/badge/🔥_FHIR-DSTU2_•%20STU3•%20R4_•%20β4.4-orange.svg?style=flat) ![Works on macOS, iOS, watchOS and tvOS](https://img.shields.io/badge/Platform-macOS_•%20iOS_•%20watchOS_•%20tvOS-blue.svg?style=flat) [![Swift Package Manager](https://img.shields.io/badge/SPM-compatible-brightgreen.svg?style=flat)][spm] [![License](https://img.shields.io/badge/License-APACHE_2.0-lightgrey.svg?style=flat)](#license) FHIRModels is a Swift library for [FHIR®][fhir] resource data models. ## Features - Native Swift representation of FHIR resources, elements and data types -- Separate targets for DSTU2, R4 and latest build versions +- Separate targets for DSTU2, STU3, R4 and latest build versions - Enforced non-nullability of mandatory parameters - Enums for most closed code systems - Enums to support value[x] types @@ -33,7 +33,7 @@ Alternatively, you can add FHIRModels to your `Package.swift` file as a dependen ```swift dependencies: [ .package(url: "https://github.com/apple/FHIRModels.git", - .upToNextMajor(from: "0.1.0")) + .upToNextMajor(from: "0.2.0")) ] ``` @@ -94,6 +94,21 @@ do { } ``` +### 3. Get resources from Bundle + +To get certain resources from a `Bundle` you can do: + +```swift +import ModelsR4 + +let data = +let bundle = try JSONDecoder().decode(ModelsR4.Bundle.self, from: data) +let observations = bundle.entry?.compactMap { + $0.resource?.get(if: ModelsR4.Observation.self) +} +// observations is an array of `Observation` instances +``` + ## Model Properties FHIR Resource and Element types are represented as Swift classes, @@ -117,6 +132,42 @@ name.given?.first?.value // FHIRString? name.given?.first?.value?.string // String? ``` +### Working with primitives + +You may be tempted to get the Swift native types from primitive values and pass these around. +To get a String from the resource ID you would do: + +```swift +let id = resource.id?.value?.string +``` + +Instead, consider passing the element around in its full form, in this case as `FHIRPrimitive`. +This means you will not lose extensions while you can still use some primitives in code as if they were native types. +With `FHIRPrimitive` for example, you can actually do: + +```swift +if resource.id == "101" { + +} +``` + +Conversely, you can also assign many `FHIRPrimitive` types with String, Bool or numeric literals, for example: + +```swift +let patient = Patient(...) +patient.id = "101" +patient.active = true +``` + +Lastly, many Swift native types have been extended to offer an `asFHIR{type}Primitive()` method. URL and String for example offer: + +```swift +let url = URL(string: "http://apple.com")!.asFHIRURIPrimitive() +// url is a `FHIRPrimitive` +let str = "http://hl7.org/fhir".asFHIRURIPrimitive() +// str is a `FHIRPrimitive?` +``` + ### Date & Time FHIRModels handles date/time ↔︎ string conversion transparently and will discard invalid dates. diff --git a/Sources/ModelsSTU3/Account.swift b/Sources/ModelsSTU3/Account.swift new file mode 100644 index 0000000..2ead72f --- /dev/null +++ b/Sources/ModelsSTU3/Account.swift @@ -0,0 +1,386 @@ +// +// Account.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Account) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Tracks balance, charges, for patient or cost center. + + A financial tool for tracking value accrued for a particular purpose. In the healthcare field, used to track charges + for a patient, cost centers, etc. + */ +open class Account: DomainResource { + + override open class var resourceType: ResourceType { return .account } + + /// Account number + public var identifier: [Identifier]? + + /// Indicates whether the account is presently used/usable or not. + public var status: FHIRPrimitive? + + /// E.g. patient, expense, depreciation + public var type: CodeableConcept? + + /// Human-readable label + public var name: FHIRPrimitive? + + /// What is account tied to? + public var subject: Reference? + + /// Transaction window + public var period: Period? + + /// Time window that transactions may be posted to this account + public var active: Period? + + /// How much is in account? + public var balance: Money? + + /// The party(s) that are responsible for covering the payment of this account, and what order should they be + /// applied to the account + public var coverage: [AccountCoverage]? + + /// Who is responsible? + public var owner: Reference? + + /// Explanation of purpose/use + public var description_fhir: FHIRPrimitive? + + /// Responsible for the account + public var guarantor: [AccountGuarantor]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + active: Period? = nil, + balance: Money? = nil, + contained: [ResourceProxy]? = nil, + coverage: [AccountCoverage]? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + guarantor: [AccountGuarantor]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + owner: Reference? = nil, + period: Period? = nil, + status: FHIRPrimitive? = nil, + subject: Reference? = nil, + text: Narrative? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.active = active + self.balance = balance + self.contained = contained + self.coverage = coverage + self.description_fhir = description_fhir + self.`extension` = `extension` + self.guarantor = guarantor + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.owner = owner + self.period = period + self.status = status + self.subject = subject + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active + case balance + case coverage + case description_fhir = "description"; case _description_fhir = "_description" + case guarantor + case identifier + case name; case _name + case owner + case period + case status; case _status + case subject + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try Period(from: _container, forKeyIfPresent: .active) + self.balance = try Money(from: _container, forKeyIfPresent: .balance) + self.coverage = try [AccountCoverage](from: _container, forKeyIfPresent: .coverage) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.guarantor = try [AccountGuarantor](from: _container, forKeyIfPresent: .guarantor) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.owner = try Reference(from: _container, forKeyIfPresent: .owner) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active) + try balance?.encode(on: &_container, forKey: .balance) + try coverage?.encode(on: &_container, forKey: .coverage) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try guarantor?.encode(on: &_container, forKey: .guarantor) + try identifier?.encode(on: &_container, forKey: .identifier) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try owner?.encode(on: &_container, forKey: .owner) + try period?.encode(on: &_container, forKey: .period) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Account else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && balance == _other.balance + && coverage == _other.coverage + && description_fhir == _other.description_fhir + && guarantor == _other.guarantor + && identifier == _other.identifier + && name == _other.name + && owner == _other.owner + && period == _other.period + && status == _other.status + && subject == _other.subject + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(balance) + hasher.combine(coverage) + hasher.combine(description_fhir) + hasher.combine(guarantor) + hasher.combine(identifier) + hasher.combine(name) + hasher.combine(owner) + hasher.combine(period) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(type) + } +} + +/** + The party(s) that are responsible for covering the payment of this account, and what order should they be applied to + the account. + */ +open class AccountCoverage: BackboneElement { + + /// The party(s) that are responsible for covering the payment of this account + public var coverage: Reference + + /// The priority of the coverage in the context of this account + public var priority: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(coverage: Reference) { + self.coverage = coverage + super.init() + } + + /// Convenience initializer + public convenience init( + coverage: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + priority: FHIRPrimitive? = nil) + { + self.init(coverage: coverage) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.priority = priority + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case coverage + case priority; case _priority + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.coverage = try Reference(from: _container, forKey: .coverage) + self.priority = try FHIRPrimitive(from: _container, forKeyIfPresent: .priority, auxiliaryKey: ._priority) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try coverage.encode(on: &_container, forKey: .coverage) + try priority?.encode(on: &_container, forKey: .priority, auxiliaryKey: ._priority) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AccountCoverage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return coverage == _other.coverage + && priority == _other.priority + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(coverage) + hasher.combine(priority) + } +} + +/** + Responsible for the account. + + Parties financially responsible for the account. + */ +open class AccountGuarantor: BackboneElement { + + /// Responsible entity + public var party: Reference + + /// Credit or other hold applied + public var onHold: FHIRPrimitive? + + /// Guarrantee account during + public var period: Period? + + /// Designated initializer taking all required properties + public init(party: Reference) { + self.party = party + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onHold: FHIRPrimitive? = nil, + party: Reference, + period: Period? = nil) + { + self.init(party: party) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onHold = onHold + self.period = period + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case onHold; case _onHold + case party + case period + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.onHold = try FHIRPrimitive(from: _container, forKeyIfPresent: .onHold, auxiliaryKey: ._onHold) + self.party = try Reference(from: _container, forKey: .party) + self.period = try Period(from: _container, forKeyIfPresent: .period) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try onHold?.encode(on: &_container, forKey: .onHold, auxiliaryKey: ._onHold) + try party.encode(on: &_container, forKey: .party) + try period?.encode(on: &_container, forKey: .period) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AccountGuarantor else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return onHold == _other.onHold + && party == _other.party + && period == _other.period + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(onHold) + hasher.combine(party) + hasher.combine(period) + } +} diff --git a/Sources/ModelsSTU3/ActivityDefinition.swift b/Sources/ModelsSTU3/ActivityDefinition.swift new file mode 100644 index 0000000..e0f080d --- /dev/null +++ b/Sources/ModelsSTU3/ActivityDefinition.swift @@ -0,0 +1,695 @@ +// +// ActivityDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ActivityDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The definition of a specific activity to be taken, independent of any particular patient or context. + + This resource allows for the definition of some activity to be performed, independent of a particular patient, + practitioner, or other performance context. + */ +open class ActivityDefinition: DomainResource { + + override open class var resourceType: ResourceType { return .activityDefinition } + + /// All possible types for "product[x]" + public enum ProductX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// All possible types for "timing[x]" + public enum TimingX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + case range(Range) + case timing(Timing) + } + + /// Logical URI to reference this activity definition (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the activity definition + public var identifier: [Identifier]? + + /// Business version of the activity definition + public var version: FHIRPrimitive? + + /// Name for this activity definition (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this activity definition (human friendly) + public var title: FHIRPrimitive? + + /// The status of this activity definition. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Natural language description of the activity definition + public var description_fhir: FHIRPrimitive? + + /// Why this activity definition is defined + public var purpose: FHIRPrimitive? + + /// Describes the clinical usage of the asset + public var usage: FHIRPrimitive? + + /// When the activity definition was approved by publisher + public var approvalDate: FHIRPrimitive? + + /// When the activity definition was last reviewed + public var lastReviewDate: FHIRPrimitive? + + /// When the activity definition is expected to be used + public var effectivePeriod: Period? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for activity definition (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// E.g. Education, Treatment, Assessment, etc + public var topic: [CodeableConcept]? + + /// A content contributor + public var contributor: [Contributor]? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Additional documentation, citations, etc + public var relatedArtifact: [RelatedArtifact]? + + /// Logic used by the asset + public var library: [Reference]? + + /// A description of the kind of resource the activity definition is representing. For example, a MedicationRequest, + /// a ProcedureRequest, or a CommunicationRequest. Typically, but not always, this is a Request resource. + public var kind: FHIRPrimitive? + + /// Detail type of activity + public var code: CodeableConcept? + + /// When activity is to occur + /// One of `timing[x]` + public var timing: TimingX? + + /// Where it should happen + public var location: Reference? + + /// Who should participate in the action + public var participant: [ActivityDefinitionParticipant]? + + /// What's administered/supplied + /// One of `product[x]` + public var product: ProductX? + + /// How much is administered/consumed/supplied + public var quantity: Quantity? + + /// Detailed dosage instructions + public var dosage: [Dosage]? + + /// What part of body to perform on + public var bodySite: [CodeableConcept]? + + /// Transform to apply the template + public var transform: Reference? + + /// Dynamic aspects of the definition + public var dynamicValue: [ActivityDefinitionDynamicValue]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + approvalDate: FHIRPrimitive? = nil, + bodySite: [CodeableConcept]? = nil, + code: CodeableConcept? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + contributor: [Contributor]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + dosage: [Dosage]? = nil, + dynamicValue: [ActivityDefinitionDynamicValue]? = nil, + effectivePeriod: Period? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + kind: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + lastReviewDate: FHIRPrimitive? = nil, + library: [Reference]? = nil, + location: Reference? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + participant: [ActivityDefinitionParticipant]? = nil, + product: ProductX? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + quantity: Quantity? = nil, + relatedArtifact: [RelatedArtifact]? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + timing: TimingX? = nil, + title: FHIRPrimitive? = nil, + topic: [CodeableConcept]? = nil, + transform: Reference? = nil, + url: FHIRPrimitive? = nil, + usage: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(status: status) + self.approvalDate = approvalDate + self.bodySite = bodySite + self.code = code + self.contact = contact + self.contained = contained + self.contributor = contributor + self.copyright = copyright + self.date = date + self.description_fhir = description_fhir + self.dosage = dosage + self.dynamicValue = dynamicValue + self.effectivePeriod = effectivePeriod + self.experimental = experimental + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.kind = kind + self.language = language + self.lastReviewDate = lastReviewDate + self.library = library + self.location = location + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.participant = participant + self.product = product + self.publisher = publisher + self.purpose = purpose + self.quantity = quantity + self.relatedArtifact = relatedArtifact + self.text = text + self.timing = timing + self.title = title + self.topic = topic + self.transform = transform + self.url = url + self.usage = usage + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case approvalDate; case _approvalDate + case bodySite + case code + case contact + case contributor + case copyright; case _copyright + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case dosage + case dynamicValue + case effectivePeriod + case experimental; case _experimental + case identifier + case jurisdiction + case kind; case _kind + case lastReviewDate; case _lastReviewDate + case library + case location + case name; case _name + case participant + case productCodeableConcept + case productReference + case publisher; case _publisher + case purpose; case _purpose + case quantity + case relatedArtifact + case status; case _status + case timingDateTime; case _timingDateTime + case timingPeriod + case timingRange + case timingTiming + case title; case _title + case topic + case transform + case url; case _url + case usage; case _usage + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.approvalDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .approvalDate, auxiliaryKey: ._approvalDate) + self.bodySite = try [CodeableConcept](from: _container, forKeyIfPresent: .bodySite) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.contributor = try [Contributor](from: _container, forKeyIfPresent: .contributor) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.dosage = try [Dosage](from: _container, forKeyIfPresent: .dosage) + self.dynamicValue = try [ActivityDefinitionDynamicValue](from: _container, forKeyIfPresent: .dynamicValue) + self.effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.kind = try FHIRPrimitive(from: _container, forKeyIfPresent: .kind, auxiliaryKey: ._kind) + self.lastReviewDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + self.library = try [Reference](from: _container, forKeyIfPresent: .library) + self.location = try Reference(from: _container, forKeyIfPresent: .location) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.participant = try [ActivityDefinitionParticipant](from: _container, forKeyIfPresent: .participant) + var _t_product: ProductX? = nil + if let productReference = try Reference(from: _container, forKeyIfPresent: .productReference) { + if _t_product != nil { + throw DecodingError.dataCorruptedError(forKey: .productReference, in: _container, debugDescription: "More than one value provided for \"product\"") + } + _t_product = .reference(productReference) + } + if let productCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .productCodeableConcept) { + if _t_product != nil { + throw DecodingError.dataCorruptedError(forKey: .productCodeableConcept, in: _container, debugDescription: "More than one value provided for \"product\"") + } + _t_product = .codeableConcept(productCodeableConcept) + } + self.product = _t_product + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.relatedArtifact = try [RelatedArtifact](from: _container, forKeyIfPresent: .relatedArtifact) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + var _t_timing: TimingX? = nil + if let timingTiming = try Timing(from: _container, forKeyIfPresent: .timingTiming) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingTiming, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .timing(timingTiming) + } + if let timingDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .timingDateTime, auxiliaryKey: ._timingDateTime) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingDateTime, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .dateTime(timingDateTime) + } + if let timingPeriod = try Period(from: _container, forKeyIfPresent: .timingPeriod) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingPeriod, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .period(timingPeriod) + } + if let timingRange = try Range(from: _container, forKeyIfPresent: .timingRange) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingRange, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .range(timingRange) + } + self.timing = _t_timing + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.topic = try [CodeableConcept](from: _container, forKeyIfPresent: .topic) + self.transform = try Reference(from: _container, forKeyIfPresent: .transform) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.usage = try FHIRPrimitive(from: _container, forKeyIfPresent: .usage, auxiliaryKey: ._usage) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try approvalDate?.encode(on: &_container, forKey: .approvalDate, auxiliaryKey: ._approvalDate) + try bodySite?.encode(on: &_container, forKey: .bodySite) + try code?.encode(on: &_container, forKey: .code) + try contact?.encode(on: &_container, forKey: .contact) + try contributor?.encode(on: &_container, forKey: .contributor) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try dosage?.encode(on: &_container, forKey: .dosage) + try dynamicValue?.encode(on: &_container, forKey: .dynamicValue) + try effectivePeriod?.encode(on: &_container, forKey: .effectivePeriod) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try kind?.encode(on: &_container, forKey: .kind, auxiliaryKey: ._kind) + try lastReviewDate?.encode(on: &_container, forKey: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + try library?.encode(on: &_container, forKey: .library) + try location?.encode(on: &_container, forKey: .location) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try participant?.encode(on: &_container, forKey: .participant) + if let _enum = product { + switch _enum { + case .reference(let _value): + try _value.encode(on: &_container, forKey: .productReference) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .productCodeableConcept) + } + } + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try quantity?.encode(on: &_container, forKey: .quantity) + try relatedArtifact?.encode(on: &_container, forKey: .relatedArtifact) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + if let _enum = timing { + switch _enum { + case .timing(let _value): + try _value.encode(on: &_container, forKey: .timingTiming) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .timingDateTime, auxiliaryKey: ._timingDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .timingPeriod) + case .range(let _value): + try _value.encode(on: &_container, forKey: .timingRange) + } + } + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try topic?.encode(on: &_container, forKey: .topic) + try transform?.encode(on: &_container, forKey: .transform) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try usage?.encode(on: &_container, forKey: .usage, auxiliaryKey: ._usage) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ActivityDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return approvalDate == _other.approvalDate + && bodySite == _other.bodySite + && code == _other.code + && contact == _other.contact + && contributor == _other.contributor + && copyright == _other.copyright + && date == _other.date + && description_fhir == _other.description_fhir + && dosage == _other.dosage + && dynamicValue == _other.dynamicValue + && effectivePeriod == _other.effectivePeriod + && experimental == _other.experimental + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && kind == _other.kind + && lastReviewDate == _other.lastReviewDate + && library == _other.library + && location == _other.location + && name == _other.name + && participant == _other.participant + && product == _other.product + && publisher == _other.publisher + && purpose == _other.purpose + && quantity == _other.quantity + && relatedArtifact == _other.relatedArtifact + && status == _other.status + && timing == _other.timing + && title == _other.title + && topic == _other.topic + && transform == _other.transform + && url == _other.url + && usage == _other.usage + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(approvalDate) + hasher.combine(bodySite) + hasher.combine(code) + hasher.combine(contact) + hasher.combine(contributor) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(dosage) + hasher.combine(dynamicValue) + hasher.combine(effectivePeriod) + hasher.combine(experimental) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(kind) + hasher.combine(lastReviewDate) + hasher.combine(library) + hasher.combine(location) + hasher.combine(name) + hasher.combine(participant) + hasher.combine(product) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(quantity) + hasher.combine(relatedArtifact) + hasher.combine(status) + hasher.combine(timing) + hasher.combine(title) + hasher.combine(topic) + hasher.combine(transform) + hasher.combine(url) + hasher.combine(usage) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Dynamic aspects of the definition. + + Dynamic values that will be evaluated to produce values for elements of the resulting resource. For example, if the + dosage of a medication must be computed based on the patient's weight, a dynamic value would be used to specify an + expression that calculated the weight, and the path on the intent resource that would contain the result. + */ +open class ActivityDefinitionDynamicValue: BackboneElement { + + /// Natural language description of the dynamic value + public var description_fhir: FHIRPrimitive? + + /// The path to the element to be set dynamically + public var path: FHIRPrimitive? + + /// Language of the expression + public var language: FHIRPrimitive? + + /// An expression that provides the dynamic value for the customization + public var expression: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + expression: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + path: FHIRPrimitive? = nil) + { + self.init() + self.description_fhir = description_fhir + self.expression = expression + self.`extension` = `extension` + self.id = id + self.language = language + self.modifierExtension = modifierExtension + self.path = path + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case expression; case _expression + case language; case _language + case path; case _path + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.expression = try FHIRPrimitive(from: _container, forKeyIfPresent: .expression, auxiliaryKey: ._expression) + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + self.path = try FHIRPrimitive(from: _container, forKeyIfPresent: .path, auxiliaryKey: ._path) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try expression?.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try path?.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ActivityDefinitionDynamicValue else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && expression == _other.expression + && language == _other.language + && path == _other.path + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(expression) + hasher.combine(language) + hasher.combine(path) + } +} + +/** + Who should participate in the action. + + Indicates who should participate in performing the action described. + */ +open class ActivityDefinitionParticipant: BackboneElement { + + /// The type of participant in the action. + public var type: FHIRPrimitive + + /// E.g. Nurse, Surgeon, Parent, etc + public var role: CodeableConcept? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + role: CodeableConcept? = nil, + type: FHIRPrimitive) + { + self.init(type: type) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case role + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try role?.encode(on: &_container, forKey: .role) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ActivityDefinitionParticipant else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return role == _other.role + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(role) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/Address.swift b/Sources/ModelsSTU3/Address.swift new file mode 100644 index 0000000..36a5f2a --- /dev/null +++ b/Sources/ModelsSTU3/Address.swift @@ -0,0 +1,182 @@ +// +// Address.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Address) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + An address expressed using postal conventions (as opposed to GPS or other location definition formats). + + An address expressed using postal conventions (as opposed to GPS or other location definition formats). This data type + may be used to convey addresses for use in delivering mail as well as for visiting locations which might not be valid + for mail delivery. There are a variety of postal address formats defined around the world. + */ +open class Address: Element { + + /// The purpose of this address. + public var use: FHIRPrimitive? + + /// Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of + /// addresses). Most addresses are both. + public var type: FHIRPrimitive? + + /// Text representation of the address + public var text: FHIRPrimitive? + + /// Street name, number, direction & P.O. Box etc. + public var line: [FHIRPrimitive]? + + /// Name of city, town etc. + public var city: FHIRPrimitive? + + /// District name (aka county) + public var district: FHIRPrimitive? + + /// Sub-unit of country (abbreviations ok) + public var state: FHIRPrimitive? + + /// Postal code for area + public var postalCode: FHIRPrimitive? + + /// Country (e.g. can be ISO 3166 2 or 3 letter code) + public var country: FHIRPrimitive? + + /// Time period when address was/is in use + public var period: Period? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + city: FHIRPrimitive? = nil, + country: FHIRPrimitive? = nil, + district: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + line: [FHIRPrimitive]? = nil, + period: Period? = nil, + postalCode: FHIRPrimitive? = nil, + state: FHIRPrimitive? = nil, + text: FHIRPrimitive? = nil, + type: FHIRPrimitive? = nil, + use: FHIRPrimitive? = nil) + { + self.init() + self.city = city + self.country = country + self.district = district + self.`extension` = `extension` + self.id = id + self.line = line + self.period = period + self.postalCode = postalCode + self.state = state + self.text = text + self.type = type + self.use = use + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case city; case _city + case country; case _country + case district; case _district + case line; case _line + case period + case postalCode; case _postalCode + case state; case _state + case text; case _text + case type; case _type + case use; case _use + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.city = try FHIRPrimitive(from: _container, forKeyIfPresent: .city, auxiliaryKey: ._city) + self.country = try FHIRPrimitive(from: _container, forKeyIfPresent: .country, auxiliaryKey: ._country) + self.district = try FHIRPrimitive(from: _container, forKeyIfPresent: .district, auxiliaryKey: ._district) + self.line = try [FHIRPrimitive](from: _container, forKeyIfPresent: .line, auxiliaryKey: ._line) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.postalCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .postalCode, auxiliaryKey: ._postalCode) + self.state = try FHIRPrimitive(from: _container, forKeyIfPresent: .state, auxiliaryKey: ._state) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + self.type = try FHIRPrimitive(from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + self.use = try FHIRPrimitive(from: _container, forKeyIfPresent: .use, auxiliaryKey: ._use) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try city?.encode(on: &_container, forKey: .city, auxiliaryKey: ._city) + try country?.encode(on: &_container, forKey: .country, auxiliaryKey: ._country) + try district?.encode(on: &_container, forKey: .district, auxiliaryKey: ._district) + try line?.encode(on: &_container, forKey: .line, auxiliaryKey: ._line) + try period?.encode(on: &_container, forKey: .period) + try postalCode?.encode(on: &_container, forKey: .postalCode, auxiliaryKey: ._postalCode) + try state?.encode(on: &_container, forKey: .state, auxiliaryKey: ._state) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try use?.encode(on: &_container, forKey: .use, auxiliaryKey: ._use) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Address else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return city == _other.city + && country == _other.country + && district == _other.district + && line == _other.line + && period == _other.period + && postalCode == _other.postalCode + && state == _other.state + && text == _other.text + && type == _other.type + && use == _other.use + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(city) + hasher.combine(country) + hasher.combine(district) + hasher.combine(line) + hasher.combine(period) + hasher.combine(postalCode) + hasher.combine(state) + hasher.combine(text) + hasher.combine(type) + hasher.combine(use) + } +} diff --git a/Sources/ModelsSTU3/AdverseEvent.swift b/Sources/ModelsSTU3/AdverseEvent.swift new file mode 100644 index 0000000..157734c --- /dev/null +++ b/Sources/ModelsSTU3/AdverseEvent.swift @@ -0,0 +1,387 @@ +// +// AdverseEvent.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/AdverseEvent) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Medical care, research study or other healthcare event causing physical injury. + + Actual or potential/avoided event causing unintended physical injury resulting from or contributed to by medical care, + a research study or other healthcare setting factors that requires additional monitoring, treatment, or + hospitalization, or that results in death. + */ +open class AdverseEvent: DomainResource { + + override open class var resourceType: ResourceType { return .adverseEvent } + + /// Business identifier for the event + public var identifier: Identifier? + + /// The type of event which is important to characterize what occurred and caused harm to the subject, or had the + /// potential to cause harm to the subject. + public var category: FHIRPrimitive? + + /// actual | potential + public var type: CodeableConcept? + + /// Subject or group impacted by event + public var subject: Reference? + + /// When the event occurred + public var date: FHIRPrimitive? + + /// Adverse Reaction Events linked to exposure to substance + public var reaction: [Reference]? + + /// Location where adverse event occurred + public var location: Reference? + + /// Mild | Moderate | Severe + public var seriousness: CodeableConcept? + + /// resolved | recovering | ongoing | resolvedWithSequelae | fatal | unknown + public var outcome: CodeableConcept? + + /// Who recorded the adverse event + public var recorder: Reference? + + /// Who was involved in the adverse event or the potential adverse event + public var eventParticipant: Reference? + + /// Description of the adverse event + public var description_fhir: FHIRPrimitive? + + /// The suspected agent causing the adverse event + public var suspectEntity: [AdverseEventSuspectEntity]? + + /// AdverseEvent.subjectMedicalHistory + public var subjectMedicalHistory: [Reference]? + + /// AdverseEvent.referenceDocument + public var referenceDocument: [Reference]? + + /// AdverseEvent.study + public var study: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + category: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + eventParticipant: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + location: Reference? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + outcome: CodeableConcept? = nil, + reaction: [Reference]? = nil, + recorder: Reference? = nil, + referenceDocument: [Reference]? = nil, + seriousness: CodeableConcept? = nil, + study: [Reference]? = nil, + subject: Reference? = nil, + subjectMedicalHistory: [Reference]? = nil, + suspectEntity: [AdverseEventSuspectEntity]? = nil, + text: Narrative? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.category = category + self.contained = contained + self.date = date + self.description_fhir = description_fhir + self.eventParticipant = eventParticipant + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.location = location + self.meta = meta + self.modifierExtension = modifierExtension + self.outcome = outcome + self.reaction = reaction + self.recorder = recorder + self.referenceDocument = referenceDocument + self.seriousness = seriousness + self.study = study + self.subject = subject + self.subjectMedicalHistory = subjectMedicalHistory + self.suspectEntity = suspectEntity + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category; case _category + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case eventParticipant + case identifier + case location + case outcome + case reaction + case recorder + case referenceDocument + case seriousness + case study + case subject + case subjectMedicalHistory + case suspectEntity + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try FHIRPrimitive(from: _container, forKeyIfPresent: .category, auxiliaryKey: ._category) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.eventParticipant = try Reference(from: _container, forKeyIfPresent: .eventParticipant) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.location = try Reference(from: _container, forKeyIfPresent: .location) + self.outcome = try CodeableConcept(from: _container, forKeyIfPresent: .outcome) + self.reaction = try [Reference](from: _container, forKeyIfPresent: .reaction) + self.recorder = try Reference(from: _container, forKeyIfPresent: .recorder) + self.referenceDocument = try [Reference](from: _container, forKeyIfPresent: .referenceDocument) + self.seriousness = try CodeableConcept(from: _container, forKeyIfPresent: .seriousness) + self.study = try [Reference](from: _container, forKeyIfPresent: .study) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.subjectMedicalHistory = try [Reference](from: _container, forKeyIfPresent: .subjectMedicalHistory) + self.suspectEntity = try [AdverseEventSuspectEntity](from: _container, forKeyIfPresent: .suspectEntity) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category?.encode(on: &_container, forKey: .category, auxiliaryKey: ._category) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try eventParticipant?.encode(on: &_container, forKey: .eventParticipant) + try identifier?.encode(on: &_container, forKey: .identifier) + try location?.encode(on: &_container, forKey: .location) + try outcome?.encode(on: &_container, forKey: .outcome) + try reaction?.encode(on: &_container, forKey: .reaction) + try recorder?.encode(on: &_container, forKey: .recorder) + try referenceDocument?.encode(on: &_container, forKey: .referenceDocument) + try seriousness?.encode(on: &_container, forKey: .seriousness) + try study?.encode(on: &_container, forKey: .study) + try subject?.encode(on: &_container, forKey: .subject) + try subjectMedicalHistory?.encode(on: &_container, forKey: .subjectMedicalHistory) + try suspectEntity?.encode(on: &_container, forKey: .suspectEntity) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AdverseEvent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && date == _other.date + && description_fhir == _other.description_fhir + && eventParticipant == _other.eventParticipant + && identifier == _other.identifier + && location == _other.location + && outcome == _other.outcome + && reaction == _other.reaction + && recorder == _other.recorder + && referenceDocument == _other.referenceDocument + && seriousness == _other.seriousness + && study == _other.study + && subject == _other.subject + && subjectMedicalHistory == _other.subjectMedicalHistory + && suspectEntity == _other.suspectEntity + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(eventParticipant) + hasher.combine(identifier) + hasher.combine(location) + hasher.combine(outcome) + hasher.combine(reaction) + hasher.combine(recorder) + hasher.combine(referenceDocument) + hasher.combine(seriousness) + hasher.combine(study) + hasher.combine(subject) + hasher.combine(subjectMedicalHistory) + hasher.combine(suspectEntity) + hasher.combine(type) + } +} + +/** + The suspected agent causing the adverse event. + + Describes the entity that is suspected to have caused the adverse event. + */ +open class AdverseEventSuspectEntity: BackboneElement { + + /// Refers to the specific entity that caused the adverse event + public var instance: Reference + + /// None + public var causality: FHIRPrimitive? + + /// assess1 | assess2 + public var causalityAssessment: CodeableConcept? + + /// AdverseEvent.suspectEntity.causalityProductRelatedness + public var causalityProductRelatedness: FHIRPrimitive? + + /// method1 | method2 + public var causalityMethod: CodeableConcept? + + /// AdverseEvent.suspectEntity.causalityAuthor + public var causalityAuthor: Reference? + + /// result1 | result2 + public var causalityResult: CodeableConcept? + + /// Designated initializer taking all required properties + public init(instance: Reference) { + self.instance = instance + super.init() + } + + /// Convenience initializer + public convenience init( + causality: FHIRPrimitive? = nil, + causalityAssessment: CodeableConcept? = nil, + causalityAuthor: Reference? = nil, + causalityMethod: CodeableConcept? = nil, + causalityProductRelatedness: FHIRPrimitive? = nil, + causalityResult: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + instance: Reference, + modifierExtension: [Extension]? = nil) + { + self.init(instance: instance) + self.causality = causality + self.causalityAssessment = causalityAssessment + self.causalityAuthor = causalityAuthor + self.causalityMethod = causalityMethod + self.causalityProductRelatedness = causalityProductRelatedness + self.causalityResult = causalityResult + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case causality; case _causality + case causalityAssessment + case causalityAuthor + case causalityMethod + case causalityProductRelatedness; case _causalityProductRelatedness + case causalityResult + case instance + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.causality = try FHIRPrimitive(from: _container, forKeyIfPresent: .causality, auxiliaryKey: ._causality) + self.causalityAssessment = try CodeableConcept(from: _container, forKeyIfPresent: .causalityAssessment) + self.causalityAuthor = try Reference(from: _container, forKeyIfPresent: .causalityAuthor) + self.causalityMethod = try CodeableConcept(from: _container, forKeyIfPresent: .causalityMethod) + self.causalityProductRelatedness = try FHIRPrimitive(from: _container, forKeyIfPresent: .causalityProductRelatedness, auxiliaryKey: ._causalityProductRelatedness) + self.causalityResult = try CodeableConcept(from: _container, forKeyIfPresent: .causalityResult) + self.instance = try Reference(from: _container, forKey: .instance) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try causality?.encode(on: &_container, forKey: .causality, auxiliaryKey: ._causality) + try causalityAssessment?.encode(on: &_container, forKey: .causalityAssessment) + try causalityAuthor?.encode(on: &_container, forKey: .causalityAuthor) + try causalityMethod?.encode(on: &_container, forKey: .causalityMethod) + try causalityProductRelatedness?.encode(on: &_container, forKey: .causalityProductRelatedness, auxiliaryKey: ._causalityProductRelatedness) + try causalityResult?.encode(on: &_container, forKey: .causalityResult) + try instance.encode(on: &_container, forKey: .instance) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AdverseEventSuspectEntity else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return causality == _other.causality + && causalityAssessment == _other.causalityAssessment + && causalityAuthor == _other.causalityAuthor + && causalityMethod == _other.causalityMethod + && causalityProductRelatedness == _other.causalityProductRelatedness + && causalityResult == _other.causalityResult + && instance == _other.instance + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(causality) + hasher.combine(causalityAssessment) + hasher.combine(causalityAuthor) + hasher.combine(causalityMethod) + hasher.combine(causalityProductRelatedness) + hasher.combine(causalityResult) + hasher.combine(instance) + } +} diff --git a/Sources/ModelsSTU3/Age.swift b/Sources/ModelsSTU3/Age.swift new file mode 100644 index 0000000..c51bb50 --- /dev/null +++ b/Sources/ModelsSTU3/Age.swift @@ -0,0 +1,79 @@ +// +// Age.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Age) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A duration of time during which an organism (or a process) has existed. + */ +open class Age: Quantity { + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive? = nil, + comparator: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + system: FHIRPrimitive? = nil, + unit: FHIRPrimitive? = nil, + value: FHIRPrimitive? = nil) + { + self.init() + self.code = code + self.comparator = comparator + self.`extension` = `extension` + self.id = id + self.system = system + self.unit = unit + self.value = value + } + + // MARK: - Codable + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Age else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return true + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + } +} diff --git a/Sources/ModelsSTU3/AllergyIntolerance.swift b/Sources/ModelsSTU3/AllergyIntolerance.swift new file mode 100644 index 0000000..6f7ef63 --- /dev/null +++ b/Sources/ModelsSTU3/AllergyIntolerance.swift @@ -0,0 +1,435 @@ +// +// AllergyIntolerance.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Allergy or Intolerance (generally: Risk of adverse reaction to a substance). + + Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to + a substance. + */ +open class AllergyIntolerance: DomainResource { + + override open class var resourceType: ResourceType { return .allergyIntolerance } + + /// All possible types for "onset[x]" + public enum OnsetX: Hashable { + case age(Age) + case dateTime(FHIRPrimitive) + case period(Period) + case range(Range) + case string(FHIRPrimitive) + } + + /// External ids for this item + public var identifier: [Identifier]? + + /// The clinical status of the allergy or intolerance. + public var clinicalStatus: FHIRPrimitive? + + /// Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified + /// substance (including pharmaceutical product). + public var verificationStatus: FHIRPrimitive + + /// Identification of the underlying physiological mechanism for the reaction risk. + public var type: FHIRPrimitive? + + /// Category of the identified substance. + public var category: [FHIRPrimitive]? + + /// Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance. + public var criticality: FHIRPrimitive? + + /// Code that identifies the allergy or intolerance + public var code: CodeableConcept? + + /// Who the sensitivity is for + public var patient: Reference + + /// When allergy or intolerance was identified + /// One of `onset[x]` + public var onset: OnsetX? + + /// Date record was believed accurate + public var assertedDate: FHIRPrimitive? + + /// Who recorded the sensitivity + public var recorder: Reference? + + /// Source of the information about the allergy + public var asserter: Reference? + + /// Date(/time) of last known occurrence of a reaction + public var lastOccurrence: FHIRPrimitive? + + /// Additional text not captured in other fields + public var note: [Annotation]? + + /// Adverse Reaction Events linked to exposure to substance + public var reaction: [AllergyIntoleranceReaction]? + + /// Designated initializer taking all required properties + public init(patient: Reference, verificationStatus: FHIRPrimitive) { + self.patient = patient + self.verificationStatus = verificationStatus + super.init() + } + + /// Convenience initializer + public convenience init( + assertedDate: FHIRPrimitive? = nil, + asserter: Reference? = nil, + category: [FHIRPrimitive]? = nil, + clinicalStatus: FHIRPrimitive? = nil, + code: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + criticality: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + lastOccurrence: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + onset: OnsetX? = nil, + patient: Reference, + reaction: [AllergyIntoleranceReaction]? = nil, + recorder: Reference? = nil, + text: Narrative? = nil, + type: FHIRPrimitive? = nil, + verificationStatus: FHIRPrimitive) + { + self.init(patient: patient, verificationStatus: verificationStatus) + self.assertedDate = assertedDate + self.asserter = asserter + self.category = category + self.clinicalStatus = clinicalStatus + self.code = code + self.contained = contained + self.criticality = criticality + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.lastOccurrence = lastOccurrence + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.onset = onset + self.reaction = reaction + self.recorder = recorder + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case assertedDate; case _assertedDate + case asserter + case category; case _category + case clinicalStatus; case _clinicalStatus + case code + case criticality; case _criticality + case identifier + case lastOccurrence; case _lastOccurrence + case note + case onsetAge + case onsetDateTime; case _onsetDateTime + case onsetPeriod + case onsetRange + case onsetString; case _onsetString + case patient + case reaction + case recorder + case type; case _type + case verificationStatus; case _verificationStatus + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.assertedDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .assertedDate, auxiliaryKey: ._assertedDate) + self.asserter = try Reference(from: _container, forKeyIfPresent: .asserter) + self.category = try [FHIRPrimitive](from: _container, forKeyIfPresent: .category, auxiliaryKey: ._category) + self.clinicalStatus = try FHIRPrimitive(from: _container, forKeyIfPresent: .clinicalStatus, auxiliaryKey: ._clinicalStatus) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.criticality = try FHIRPrimitive(from: _container, forKeyIfPresent: .criticality, auxiliaryKey: ._criticality) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.lastOccurrence = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastOccurrence, auxiliaryKey: ._lastOccurrence) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + var _t_onset: OnsetX? = nil + if let onsetDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .onsetDateTime, auxiliaryKey: ._onsetDateTime) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetDateTime, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .dateTime(onsetDateTime) + } + if let onsetAge = try Age(from: _container, forKeyIfPresent: .onsetAge) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetAge, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .age(onsetAge) + } + if let onsetPeriod = try Period(from: _container, forKeyIfPresent: .onsetPeriod) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetPeriod, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .period(onsetPeriod) + } + if let onsetRange = try Range(from: _container, forKeyIfPresent: .onsetRange) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetRange, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .range(onsetRange) + } + if let onsetString = try FHIRPrimitive(from: _container, forKeyIfPresent: .onsetString, auxiliaryKey: ._onsetString) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetString, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .string(onsetString) + } + self.onset = _t_onset + self.patient = try Reference(from: _container, forKey: .patient) + self.reaction = try [AllergyIntoleranceReaction](from: _container, forKeyIfPresent: .reaction) + self.recorder = try Reference(from: _container, forKeyIfPresent: .recorder) + self.type = try FHIRPrimitive(from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + self.verificationStatus = try FHIRPrimitive(from: _container, forKey: .verificationStatus, auxiliaryKey: ._verificationStatus) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try assertedDate?.encode(on: &_container, forKey: .assertedDate, auxiliaryKey: ._assertedDate) + try asserter?.encode(on: &_container, forKey: .asserter) + try category?.encode(on: &_container, forKey: .category, auxiliaryKey: ._category) + try clinicalStatus?.encode(on: &_container, forKey: .clinicalStatus, auxiliaryKey: ._clinicalStatus) + try code?.encode(on: &_container, forKey: .code) + try criticality?.encode(on: &_container, forKey: .criticality, auxiliaryKey: ._criticality) + try identifier?.encode(on: &_container, forKey: .identifier) + try lastOccurrence?.encode(on: &_container, forKey: .lastOccurrence, auxiliaryKey: ._lastOccurrence) + try note?.encode(on: &_container, forKey: .note) + if let _enum = onset { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .onsetDateTime, auxiliaryKey: ._onsetDateTime) + case .age(let _value): + try _value.encode(on: &_container, forKey: .onsetAge) + case .period(let _value): + try _value.encode(on: &_container, forKey: .onsetPeriod) + case .range(let _value): + try _value.encode(on: &_container, forKey: .onsetRange) + case .string(let _value): + try _value.encode(on: &_container, forKey: .onsetString, auxiliaryKey: ._onsetString) + } + } + try patient.encode(on: &_container, forKey: .patient) + try reaction?.encode(on: &_container, forKey: .reaction) + try recorder?.encode(on: &_container, forKey: .recorder) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try verificationStatus.encode(on: &_container, forKey: .verificationStatus, auxiliaryKey: ._verificationStatus) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AllergyIntolerance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return assertedDate == _other.assertedDate + && asserter == _other.asserter + && category == _other.category + && clinicalStatus == _other.clinicalStatus + && code == _other.code + && criticality == _other.criticality + && identifier == _other.identifier + && lastOccurrence == _other.lastOccurrence + && note == _other.note + && onset == _other.onset + && patient == _other.patient + && reaction == _other.reaction + && recorder == _other.recorder + && type == _other.type + && verificationStatus == _other.verificationStatus + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(assertedDate) + hasher.combine(asserter) + hasher.combine(category) + hasher.combine(clinicalStatus) + hasher.combine(code) + hasher.combine(criticality) + hasher.combine(identifier) + hasher.combine(lastOccurrence) + hasher.combine(note) + hasher.combine(onset) + hasher.combine(patient) + hasher.combine(reaction) + hasher.combine(recorder) + hasher.combine(type) + hasher.combine(verificationStatus) + } +} + +/** + Adverse Reaction Events linked to exposure to substance. + + Details about each adverse reaction event linked to exposure to the identified substance. + */ +open class AllergyIntoleranceReaction: BackboneElement { + + /// Specific substance or pharmaceutical product considered to be responsible for event + public var substance: CodeableConcept? + + /// Clinical symptoms/signs associated with the Event + public var manifestation: [CodeableConcept] + + /// Description of the event as a whole + public var description_fhir: FHIRPrimitive? + + /// Date(/time) when manifestations showed + public var onset: FHIRPrimitive? + + /// Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different + /// manifestations. + public var severity: FHIRPrimitive? + + /// How the subject was exposed to the substance + public var exposureRoute: CodeableConcept? + + /// Text about event not captured in other fields + public var note: [Annotation]? + + /// Designated initializer taking all required properties + public init(manifestation: [CodeableConcept]) { + self.manifestation = manifestation + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + exposureRoute: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + manifestation: [CodeableConcept], + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + onset: FHIRPrimitive? = nil, + severity: FHIRPrimitive? = nil, + substance: CodeableConcept? = nil) + { + self.init(manifestation: manifestation) + self.description_fhir = description_fhir + self.exposureRoute = exposureRoute + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.note = note + self.onset = onset + self.severity = severity + self.substance = substance + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case exposureRoute + case manifestation + case note + case onset; case _onset + case severity; case _severity + case substance + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.exposureRoute = try CodeableConcept(from: _container, forKeyIfPresent: .exposureRoute) + self.manifestation = try [CodeableConcept](from: _container, forKey: .manifestation) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.onset = try FHIRPrimitive(from: _container, forKeyIfPresent: .onset, auxiliaryKey: ._onset) + self.severity = try FHIRPrimitive(from: _container, forKeyIfPresent: .severity, auxiliaryKey: ._severity) + self.substance = try CodeableConcept(from: _container, forKeyIfPresent: .substance) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try exposureRoute?.encode(on: &_container, forKey: .exposureRoute) + try manifestation.encode(on: &_container, forKey: .manifestation) + try note?.encode(on: &_container, forKey: .note) + try onset?.encode(on: &_container, forKey: .onset, auxiliaryKey: ._onset) + try severity?.encode(on: &_container, forKey: .severity, auxiliaryKey: ._severity) + try substance?.encode(on: &_container, forKey: .substance) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AllergyIntoleranceReaction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && exposureRoute == _other.exposureRoute + && manifestation == _other.manifestation + && note == _other.note + && onset == _other.onset + && severity == _other.severity + && substance == _other.substance + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(exposureRoute) + hasher.combine(manifestation) + hasher.combine(note) + hasher.combine(onset) + hasher.combine(severity) + hasher.combine(substance) + } +} diff --git a/Sources/ModelsSTU3/Annotation.swift b/Sources/ModelsSTU3/Annotation.swift new file mode 100644 index 0000000..e9bdf87 --- /dev/null +++ b/Sources/ModelsSTU3/Annotation.swift @@ -0,0 +1,137 @@ +// +// Annotation.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Annotation) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Text node with attribution. + + A text note which also contains information about who made the statement and when. + */ +open class Annotation: Element { + + /// All possible types for "author[x]" + public enum AuthorX: Hashable { + case reference(Reference) + case string(FHIRPrimitive) + } + + /// Individual responsible for the annotation + /// One of `author[x]` + public var author: AuthorX? + + /// When the annotation was made + public var time: FHIRPrimitive? + + /// The annotation - text content + public var text: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(text: FHIRPrimitive) { + self.text = text + super.init() + } + + /// Convenience initializer + public convenience init( + author: AuthorX? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + text: FHIRPrimitive, + time: FHIRPrimitive? = nil) + { + self.init(text: text) + self.author = author + self.`extension` = `extension` + self.id = id + self.time = time + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authorReference + case authorString; case _authorString + case text; case _text + case time; case _time + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_author: AuthorX? = nil + if let authorReference = try Reference(from: _container, forKeyIfPresent: .authorReference) { + if _t_author != nil { + throw DecodingError.dataCorruptedError(forKey: .authorReference, in: _container, debugDescription: "More than one value provided for \"author\"") + } + _t_author = .reference(authorReference) + } + if let authorString = try FHIRPrimitive(from: _container, forKeyIfPresent: .authorString, auxiliaryKey: ._authorString) { + if _t_author != nil { + throw DecodingError.dataCorruptedError(forKey: .authorString, in: _container, debugDescription: "More than one value provided for \"author\"") + } + _t_author = .string(authorString) + } + self.author = _t_author + self.text = try FHIRPrimitive(from: _container, forKey: .text, auxiliaryKey: ._text) + self.time = try FHIRPrimitive(from: _container, forKeyIfPresent: .time, auxiliaryKey: ._time) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = author { + switch _enum { + case .reference(let _value): + try _value.encode(on: &_container, forKey: .authorReference) + case .string(let _value): + try _value.encode(on: &_container, forKey: .authorString, auxiliaryKey: ._authorString) + } + } + try text.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try time?.encode(on: &_container, forKey: .time, auxiliaryKey: ._time) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Annotation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return author == _other.author + && text == _other.text + && time == _other.time + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(author) + hasher.combine(text) + hasher.combine(time) + } +} diff --git a/Sources/ModelsSTU3/Appointment.swift b/Sources/ModelsSTU3/Appointment.swift new file mode 100644 index 0000000..ffe85ff --- /dev/null +++ b/Sources/ModelsSTU3/Appointment.swift @@ -0,0 +1,395 @@ +// +// Appointment.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Appointment) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific + date/time. This may result in one or more Encounter(s). + */ +open class Appointment: DomainResource { + + override open class var resourceType: ResourceType { return .appointment } + + /// External Ids for this item + public var identifier: [Identifier]? + + /// The overall status of the Appointment. Each of the participants has their own participation status which + /// indicates their involvement in the process, however this status indicates the shared status. + public var status: FHIRPrimitive + + /// A broad categorisation of the service that is to be performed during this appointment + public var serviceCategory: CodeableConcept? + + /// The specific service that is to be performed during this appointment + public var serviceType: [CodeableConcept]? + + /// The specialty of a practitioner that would be required to perform the service requested in this appointment + public var specialty: [CodeableConcept]? + + /// The style of appointment or patient that has been booked in the slot (not service type) + public var appointmentType: CodeableConcept? + + /// Reason this appointment is scheduled + public var reason: [CodeableConcept]? + + /// Reason the appointment is to takes place (resource) + public var indication: [Reference]? + + /// Used to make informed decisions if needing to re-prioritize + public var priority: FHIRPrimitive? + + /// Shown on a subject line in a meeting request, or appointment list + public var description_fhir: FHIRPrimitive? + + /// Additional information to support the appointment + public var supportingInformation: [Reference]? + + /// When appointment is to take place + public var start: FHIRPrimitive? + + /// When appointment is to conclude + public var end: FHIRPrimitive? + + /// Can be less than start/end (e.g. estimate) + public var minutesDuration: FHIRPrimitive? + + /// The slots that this appointment is filling + public var slot: [Reference]? + + /// The date that this appointment was initially created + public var created: FHIRPrimitive? + + /// Additional comments + public var comment: FHIRPrimitive? + + /// The ReferralRequest provided as information to allocate to the Encounter + public var incomingReferral: [Reference]? + + /// Participants involved in appointment + public var participant: [AppointmentParticipant] + + /// Potential date/time interval(s) requested to allocate the appointment within + public var requestedPeriod: [Period]? + + /// Designated initializer taking all required properties + public init(participant: [AppointmentParticipant], status: FHIRPrimitive) { + self.participant = participant + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + appointmentType: CodeableConcept? = nil, + comment: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + end: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + incomingReferral: [Reference]? = nil, + indication: [Reference]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + minutesDuration: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + participant: [AppointmentParticipant], + priority: FHIRPrimitive? = nil, + reason: [CodeableConcept]? = nil, + requestedPeriod: [Period]? = nil, + serviceCategory: CodeableConcept? = nil, + serviceType: [CodeableConcept]? = nil, + slot: [Reference]? = nil, + specialty: [CodeableConcept]? = nil, + start: FHIRPrimitive? = nil, + status: FHIRPrimitive, + supportingInformation: [Reference]? = nil, + text: Narrative? = nil) + { + self.init(participant: participant, status: status) + self.appointmentType = appointmentType + self.comment = comment + self.contained = contained + self.created = created + self.description_fhir = description_fhir + self.end = end + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.incomingReferral = incomingReferral + self.indication = indication + self.language = language + self.meta = meta + self.minutesDuration = minutesDuration + self.modifierExtension = modifierExtension + self.priority = priority + self.reason = reason + self.requestedPeriod = requestedPeriod + self.serviceCategory = serviceCategory + self.serviceType = serviceType + self.slot = slot + self.specialty = specialty + self.start = start + self.supportingInformation = supportingInformation + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case appointmentType + case comment; case _comment + case created; case _created + case description_fhir = "description"; case _description_fhir = "_description" + case end; case _end + case identifier + case incomingReferral + case indication + case minutesDuration; case _minutesDuration + case participant + case priority; case _priority + case reason + case requestedPeriod + case serviceCategory + case serviceType + case slot + case specialty + case start; case _start + case status; case _status + case supportingInformation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.appointmentType = try CodeableConcept(from: _container, forKeyIfPresent: .appointmentType) + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.end = try FHIRPrimitive(from: _container, forKeyIfPresent: .end, auxiliaryKey: ._end) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.incomingReferral = try [Reference](from: _container, forKeyIfPresent: .incomingReferral) + self.indication = try [Reference](from: _container, forKeyIfPresent: .indication) + self.minutesDuration = try FHIRPrimitive(from: _container, forKeyIfPresent: .minutesDuration, auxiliaryKey: ._minutesDuration) + self.participant = try [AppointmentParticipant](from: _container, forKey: .participant) + self.priority = try FHIRPrimitive(from: _container, forKeyIfPresent: .priority, auxiliaryKey: ._priority) + self.reason = try [CodeableConcept](from: _container, forKeyIfPresent: .reason) + self.requestedPeriod = try [Period](from: _container, forKeyIfPresent: .requestedPeriod) + self.serviceCategory = try CodeableConcept(from: _container, forKeyIfPresent: .serviceCategory) + self.serviceType = try [CodeableConcept](from: _container, forKeyIfPresent: .serviceType) + self.slot = try [Reference](from: _container, forKeyIfPresent: .slot) + self.specialty = try [CodeableConcept](from: _container, forKeyIfPresent: .specialty) + self.start = try FHIRPrimitive(from: _container, forKeyIfPresent: .start, auxiliaryKey: ._start) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.supportingInformation = try [Reference](from: _container, forKeyIfPresent: .supportingInformation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try appointmentType?.encode(on: &_container, forKey: .appointmentType) + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try end?.encode(on: &_container, forKey: .end, auxiliaryKey: ._end) + try identifier?.encode(on: &_container, forKey: .identifier) + try incomingReferral?.encode(on: &_container, forKey: .incomingReferral) + try indication?.encode(on: &_container, forKey: .indication) + try minutesDuration?.encode(on: &_container, forKey: .minutesDuration, auxiliaryKey: ._minutesDuration) + try participant.encode(on: &_container, forKey: .participant) + try priority?.encode(on: &_container, forKey: .priority, auxiliaryKey: ._priority) + try reason?.encode(on: &_container, forKey: .reason) + try requestedPeriod?.encode(on: &_container, forKey: .requestedPeriod) + try serviceCategory?.encode(on: &_container, forKey: .serviceCategory) + try serviceType?.encode(on: &_container, forKey: .serviceType) + try slot?.encode(on: &_container, forKey: .slot) + try specialty?.encode(on: &_container, forKey: .specialty) + try start?.encode(on: &_container, forKey: .start, auxiliaryKey: ._start) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try supportingInformation?.encode(on: &_container, forKey: .supportingInformation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Appointment else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return appointmentType == _other.appointmentType + && comment == _other.comment + && created == _other.created + && description_fhir == _other.description_fhir + && end == _other.end + && identifier == _other.identifier + && incomingReferral == _other.incomingReferral + && indication == _other.indication + && minutesDuration == _other.minutesDuration + && participant == _other.participant + && priority == _other.priority + && reason == _other.reason + && requestedPeriod == _other.requestedPeriod + && serviceCategory == _other.serviceCategory + && serviceType == _other.serviceType + && slot == _other.slot + && specialty == _other.specialty + && start == _other.start + && status == _other.status + && supportingInformation == _other.supportingInformation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(appointmentType) + hasher.combine(comment) + hasher.combine(created) + hasher.combine(description_fhir) + hasher.combine(end) + hasher.combine(identifier) + hasher.combine(incomingReferral) + hasher.combine(indication) + hasher.combine(minutesDuration) + hasher.combine(participant) + hasher.combine(priority) + hasher.combine(reason) + hasher.combine(requestedPeriod) + hasher.combine(serviceCategory) + hasher.combine(serviceType) + hasher.combine(slot) + hasher.combine(specialty) + hasher.combine(start) + hasher.combine(status) + hasher.combine(supportingInformation) + } +} + +/** + Participants involved in appointment. + + List of participants involved in the appointment. + */ +open class AppointmentParticipant: BackboneElement { + + /// Role of participant in the appointment + public var type: [CodeableConcept]? + + /// Person, Location/HealthcareService or Device + public var actor: Reference? + + /// Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet + /// to discuss the results for a specific patient, and the patient is not required to be present. + public var required: FHIRPrimitive? + + /// Participation status of the actor. + public var status: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + actor: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + required: FHIRPrimitive? = nil, + status: FHIRPrimitive, + type: [CodeableConcept]? = nil) + { + self.init(status: status) + self.actor = actor + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.required = required + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actor + case required; case _required + case status; case _status + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actor = try Reference(from: _container, forKeyIfPresent: .actor) + self.required = try FHIRPrimitive(from: _container, forKeyIfPresent: .required, auxiliaryKey: ._required) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.type = try [CodeableConcept](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actor?.encode(on: &_container, forKey: .actor) + try required?.encode(on: &_container, forKey: .required, auxiliaryKey: ._required) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AppointmentParticipant else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actor == _other.actor + && required == _other.required + && status == _other.status + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actor) + hasher.combine(required) + hasher.combine(status) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/AppointmentResponse.swift b/Sources/ModelsSTU3/AppointmentResponse.swift new file mode 100644 index 0000000..6b5fee9 --- /dev/null +++ b/Sources/ModelsSTU3/AppointmentResponse.swift @@ -0,0 +1,174 @@ +// +// AppointmentResponse.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection. + */ +open class AppointmentResponse: DomainResource { + + override open class var resourceType: ResourceType { return .appointmentResponse } + + /// External Ids for this item + public var identifier: [Identifier]? + + /// Appointment this response relates to + public var appointment: Reference + + /// Time from appointment, or requested new start time + public var start: FHIRPrimitive? + + /// Time from appointment, or requested new end time + public var end: FHIRPrimitive? + + /// Role of participant in the appointment + public var participantType: [CodeableConcept]? + + /// Person, Location/HealthcareService or Device + public var actor: Reference? + + /// Participation status of the participant. When the status is declined or tentative if the start/end times are + /// different to the appointment, then these times should be interpreted as a requested time change. When the status + /// is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be + /// empty. + public var participantStatus: FHIRPrimitive + + /// Additional comments + public var comment: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(appointment: Reference, participantStatus: FHIRPrimitive) { + self.appointment = appointment + self.participantStatus = participantStatus + super.init() + } + + /// Convenience initializer + public convenience init( + actor: Reference? = nil, + appointment: Reference, + comment: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + end: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + participantStatus: FHIRPrimitive, + participantType: [CodeableConcept]? = nil, + start: FHIRPrimitive? = nil, + text: Narrative? = nil) + { + self.init(appointment: appointment, participantStatus: participantStatus) + self.actor = actor + self.comment = comment + self.contained = contained + self.end = end + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.participantType = participantType + self.start = start + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actor + case appointment + case comment; case _comment + case end; case _end + case identifier + case participantStatus; case _participantStatus + case participantType + case start; case _start + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actor = try Reference(from: _container, forKeyIfPresent: .actor) + self.appointment = try Reference(from: _container, forKey: .appointment) + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.end = try FHIRPrimitive(from: _container, forKeyIfPresent: .end, auxiliaryKey: ._end) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.participantStatus = try FHIRPrimitive(from: _container, forKey: .participantStatus, auxiliaryKey: ._participantStatus) + self.participantType = try [CodeableConcept](from: _container, forKeyIfPresent: .participantType) + self.start = try FHIRPrimitive(from: _container, forKeyIfPresent: .start, auxiliaryKey: ._start) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actor?.encode(on: &_container, forKey: .actor) + try appointment.encode(on: &_container, forKey: .appointment) + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try end?.encode(on: &_container, forKey: .end, auxiliaryKey: ._end) + try identifier?.encode(on: &_container, forKey: .identifier) + try participantStatus.encode(on: &_container, forKey: .participantStatus, auxiliaryKey: ._participantStatus) + try participantType?.encode(on: &_container, forKey: .participantType) + try start?.encode(on: &_container, forKey: .start, auxiliaryKey: ._start) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AppointmentResponse else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actor == _other.actor + && appointment == _other.appointment + && comment == _other.comment + && end == _other.end + && identifier == _other.identifier + && participantStatus == _other.participantStatus + && participantType == _other.participantType + && start == _other.start + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actor) + hasher.combine(appointment) + hasher.combine(comment) + hasher.combine(end) + hasher.combine(identifier) + hasher.combine(participantStatus) + hasher.combine(participantType) + hasher.combine(start) + } +} diff --git a/Sources/ModelsSTU3/Attachment.swift b/Sources/ModelsSTU3/Attachment.swift new file mode 100644 index 0000000..1737f34 --- /dev/null +++ b/Sources/ModelsSTU3/Attachment.swift @@ -0,0 +1,159 @@ +// +// Attachment.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Attachment) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Content in a format defined elsewhere. + + For referring to data content defined in other formats. + */ +open class Attachment: Element { + + /// Mime type of the content, with charset etc. + public var contentType: FHIRPrimitive? + + /// Human language of the content (BCP-47) + public var language: FHIRPrimitive? + + /// Data inline, base64ed + public var data: FHIRPrimitive? + + /// Uri where the data can be found + public var url: FHIRPrimitive? + + /// Number of bytes of content (if url provided) + public var size: FHIRPrimitive? + + /// Hash of the data (sha-1, base64ed) + public var hash: FHIRPrimitive? + + /// Label to display in place of the data + public var title: FHIRPrimitive? + + /// Date attachment was first created + public var creation: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + contentType: FHIRPrimitive? = nil, + creation: FHIRPrimitive? = nil, + data: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + hash: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + size: FHIRPrimitive? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive? = nil) + { + self.init() + self.contentType = contentType + self.creation = creation + self.data = data + self.`extension` = `extension` + self.hash = hash + self.id = id + self.language = language + self.size = size + self.title = title + self.url = url + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contentType; case _contentType + case creation; case _creation + case data; case _data + case hash; case _hash + case language; case _language + case size; case _size + case title; case _title + case url; case _url + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contentType = try FHIRPrimitive(from: _container, forKeyIfPresent: .contentType, auxiliaryKey: ._contentType) + self.creation = try FHIRPrimitive(from: _container, forKeyIfPresent: .creation, auxiliaryKey: ._creation) + self.data = try FHIRPrimitive(from: _container, forKeyIfPresent: .data, auxiliaryKey: ._data) + self.hash = try FHIRPrimitive(from: _container, forKeyIfPresent: .hash, auxiliaryKey: ._hash) + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + self.size = try FHIRPrimitive(from: _container, forKeyIfPresent: .size, auxiliaryKey: ._size) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contentType?.encode(on: &_container, forKey: .contentType, auxiliaryKey: ._contentType) + try creation?.encode(on: &_container, forKey: .creation, auxiliaryKey: ._creation) + try data?.encode(on: &_container, forKey: .data, auxiliaryKey: ._data) + try hash?.encode(on: &_container, forKey: .hash, auxiliaryKey: ._hash) + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try size?.encode(on: &_container, forKey: .size, auxiliaryKey: ._size) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Attachment else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contentType == _other.contentType + && creation == _other.creation + && data == _other.data + && hash == _other.hash + && language == _other.language + && size == _other.size + && title == _other.title + && url == _other.url + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contentType) + hasher.combine(creation) + hasher.combine(data) + hasher.combine(hash) + hasher.combine(language) + hasher.combine(size) + hasher.combine(title) + hasher.combine(url) + } +} diff --git a/Sources/ModelsSTU3/AuditEvent.swift b/Sources/ModelsSTU3/AuditEvent.swift new file mode 100644 index 0000000..b404dfe --- /dev/null +++ b/Sources/ModelsSTU3/AuditEvent.swift @@ -0,0 +1,779 @@ +// +// AuditEvent.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/AuditEvent) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Event record kept for security purposes. + + A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion + attempts and monitoring for inappropriate usage. + */ +open class AuditEvent: DomainResource { + + override open class var resourceType: ResourceType { return .auditEvent } + + /// Type/identifier of event + public var type: Coding + + /// More specific type/id for the event + public var subtype: [Coding]? + + /// Indicator for type of action performed during the event that generated the audit. + public var action: FHIRPrimitive? + + /// Time when the event occurred on source + public var recorded: FHIRPrimitive + + /// Whether the event succeeded or failed + public var outcome: FHIRPrimitive? + + /// Description of the event outcome + public var outcomeDesc: FHIRPrimitive? + + /// The purposeOfUse of the event + public var purposeOfEvent: [CodeableConcept]? + + /// Actor involved in the event + public var agent: [AuditEventAgent] + + /// Audit Event Reporter + public var source: AuditEventSource + + /// Data or objects used + public var entity: [AuditEventEntity]? + + /// Designated initializer taking all required properties + public init(agent: [AuditEventAgent], recorded: FHIRPrimitive, source: AuditEventSource, type: Coding) { + self.agent = agent + self.recorded = recorded + self.source = source + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + action: FHIRPrimitive? = nil, + agent: [AuditEventAgent], + contained: [ResourceProxy]? = nil, + entity: [AuditEventEntity]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + outcome: FHIRPrimitive? = nil, + outcomeDesc: FHIRPrimitive? = nil, + purposeOfEvent: [CodeableConcept]? = nil, + recorded: FHIRPrimitive, + source: AuditEventSource, + subtype: [Coding]? = nil, + text: Narrative? = nil, + type: Coding) + { + self.init(agent: agent, recorded: recorded, source: source, type: type) + self.action = action + self.contained = contained + self.entity = entity + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.outcome = outcome + self.outcomeDesc = outcomeDesc + self.purposeOfEvent = purposeOfEvent + self.subtype = subtype + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action; case _action + case agent + case entity + case outcome; case _outcome + case outcomeDesc; case _outcomeDesc + case purposeOfEvent + case recorded; case _recorded + case source + case subtype + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try FHIRPrimitive(from: _container, forKeyIfPresent: .action, auxiliaryKey: ._action) + self.agent = try [AuditEventAgent](from: _container, forKey: .agent) + self.entity = try [AuditEventEntity](from: _container, forKeyIfPresent: .entity) + self.outcome = try FHIRPrimitive(from: _container, forKeyIfPresent: .outcome, auxiliaryKey: ._outcome) + self.outcomeDesc = try FHIRPrimitive(from: _container, forKeyIfPresent: .outcomeDesc, auxiliaryKey: ._outcomeDesc) + self.purposeOfEvent = try [CodeableConcept](from: _container, forKeyIfPresent: .purposeOfEvent) + self.recorded = try FHIRPrimitive(from: _container, forKey: .recorded, auxiliaryKey: ._recorded) + self.source = try AuditEventSource(from: _container, forKey: .source) + self.subtype = try [Coding](from: _container, forKeyIfPresent: .subtype) + self.type = try Coding(from: _container, forKey: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action, auxiliaryKey: ._action) + try agent.encode(on: &_container, forKey: .agent) + try entity?.encode(on: &_container, forKey: .entity) + try outcome?.encode(on: &_container, forKey: .outcome, auxiliaryKey: ._outcome) + try outcomeDesc?.encode(on: &_container, forKey: .outcomeDesc, auxiliaryKey: ._outcomeDesc) + try purposeOfEvent?.encode(on: &_container, forKey: .purposeOfEvent) + try recorded.encode(on: &_container, forKey: .recorded, auxiliaryKey: ._recorded) + try source.encode(on: &_container, forKey: .source) + try subtype?.encode(on: &_container, forKey: .subtype) + try type.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AuditEvent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && agent == _other.agent + && entity == _other.entity + && outcome == _other.outcome + && outcomeDesc == _other.outcomeDesc + && purposeOfEvent == _other.purposeOfEvent + && recorded == _other.recorded + && source == _other.source + && subtype == _other.subtype + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(agent) + hasher.combine(entity) + hasher.combine(outcome) + hasher.combine(outcomeDesc) + hasher.combine(purposeOfEvent) + hasher.combine(recorded) + hasher.combine(source) + hasher.combine(subtype) + hasher.combine(type) + } +} + +/** + Actor involved in the event. + + An actor taking an active role in the event or activity that is logged. + */ +open class AuditEventAgent: BackboneElement { + + /// Agent role in the event + public var role: [CodeableConcept]? + + /// Direct reference to resource + public var reference: Reference? + + /// Unique identifier for the user + public var userId: Identifier? + + /// Alternative User id e.g. authentication + public var altId: FHIRPrimitive? + + /// Human-meaningful name for the agent + public var name: FHIRPrimitive? + + /// Whether user is initiator + public var requestor: FHIRPrimitive + + /// Where + public var location: Reference? + + /// Policy that authorized event + public var policy: [FHIRPrimitive]? + + /// Type of media + public var media: Coding? + + /// Logical network location for application activity + public var network: AuditEventAgentNetwork? + + /// Reason given for this user + public var purposeOfUse: [CodeableConcept]? + + /// Designated initializer taking all required properties + public init(requestor: FHIRPrimitive) { + self.requestor = requestor + super.init() + } + + /// Convenience initializer + public convenience init( + altId: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + location: Reference? = nil, + media: Coding? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + network: AuditEventAgentNetwork? = nil, + policy: [FHIRPrimitive]? = nil, + purposeOfUse: [CodeableConcept]? = nil, + reference: Reference? = nil, + requestor: FHIRPrimitive, + role: [CodeableConcept]? = nil, + userId: Identifier? = nil) + { + self.init(requestor: requestor) + self.altId = altId + self.`extension` = `extension` + self.id = id + self.location = location + self.media = media + self.modifierExtension = modifierExtension + self.name = name + self.network = network + self.policy = policy + self.purposeOfUse = purposeOfUse + self.reference = reference + self.role = role + self.userId = userId + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case altId; case _altId + case location + case media + case name; case _name + case network + case policy; case _policy + case purposeOfUse + case reference + case requestor; case _requestor + case role + case userId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.altId = try FHIRPrimitive(from: _container, forKeyIfPresent: .altId, auxiliaryKey: ._altId) + self.location = try Reference(from: _container, forKeyIfPresent: .location) + self.media = try Coding(from: _container, forKeyIfPresent: .media) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.network = try AuditEventAgentNetwork(from: _container, forKeyIfPresent: .network) + self.policy = try [FHIRPrimitive](from: _container, forKeyIfPresent: .policy, auxiliaryKey: ._policy) + self.purposeOfUse = try [CodeableConcept](from: _container, forKeyIfPresent: .purposeOfUse) + self.reference = try Reference(from: _container, forKeyIfPresent: .reference) + self.requestor = try FHIRPrimitive(from: _container, forKey: .requestor, auxiliaryKey: ._requestor) + self.role = try [CodeableConcept](from: _container, forKeyIfPresent: .role) + self.userId = try Identifier(from: _container, forKeyIfPresent: .userId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try altId?.encode(on: &_container, forKey: .altId, auxiliaryKey: ._altId) + try location?.encode(on: &_container, forKey: .location) + try media?.encode(on: &_container, forKey: .media) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try network?.encode(on: &_container, forKey: .network) + try policy?.encode(on: &_container, forKey: .policy, auxiliaryKey: ._policy) + try purposeOfUse?.encode(on: &_container, forKey: .purposeOfUse) + try reference?.encode(on: &_container, forKey: .reference) + try requestor.encode(on: &_container, forKey: .requestor, auxiliaryKey: ._requestor) + try role?.encode(on: &_container, forKey: .role) + try userId?.encode(on: &_container, forKey: .userId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AuditEventAgent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return altId == _other.altId + && location == _other.location + && media == _other.media + && name == _other.name + && network == _other.network + && policy == _other.policy + && purposeOfUse == _other.purposeOfUse + && reference == _other.reference + && requestor == _other.requestor + && role == _other.role + && userId == _other.userId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(altId) + hasher.combine(location) + hasher.combine(media) + hasher.combine(name) + hasher.combine(network) + hasher.combine(policy) + hasher.combine(purposeOfUse) + hasher.combine(reference) + hasher.combine(requestor) + hasher.combine(role) + hasher.combine(userId) + } +} + +/** + Logical network location for application activity. + + Logical network location for application activity, if the activity has a network location. + */ +open class AuditEventAgentNetwork: BackboneElement { + + /// Identifier for the network access point of the user device + public var address: FHIRPrimitive? + + /// The type of network access point + public var type: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + address: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: FHIRPrimitive? = nil) + { + self.init() + self.address = address + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case address; case _address + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.address = try FHIRPrimitive(from: _container, forKeyIfPresent: .address, auxiliaryKey: ._address) + self.type = try FHIRPrimitive(from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try address?.encode(on: &_container, forKey: .address, auxiliaryKey: ._address) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AuditEventAgentNetwork else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return address == _other.address + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(address) + hasher.combine(type) + } +} + +/** + Data or objects used. + + Specific instances of data or objects that have been accessed. + */ +open class AuditEventEntity: BackboneElement { + + /// Specific instance of object + public var identifier: Identifier? + + /// Specific instance of resource + public var reference: Reference? + + /// Type of entity involved + public var type: Coding? + + /// What role the entity played + public var role: Coding? + + /// Life-cycle stage for the entity + public var lifecycle: Coding? + + /// Security labels on the entity + public var securityLabel: [Coding]? + + /// Descriptor for entity + public var name: FHIRPrimitive? + + /// Descriptive text + public var description_fhir: FHIRPrimitive? + + /// Query parameters + public var query: FHIRPrimitive? + + /// Additional Information about the entity + public var detail: [AuditEventEntityDetail]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + detail: [AuditEventEntityDetail]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + lifecycle: Coding? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + query: FHIRPrimitive? = nil, + reference: Reference? = nil, + role: Coding? = nil, + securityLabel: [Coding]? = nil, + type: Coding? = nil) + { + self.init() + self.description_fhir = description_fhir + self.detail = detail + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.lifecycle = lifecycle + self.modifierExtension = modifierExtension + self.name = name + self.query = query + self.reference = reference + self.role = role + self.securityLabel = securityLabel + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case detail + case identifier + case lifecycle + case name; case _name + case query; case _query + case reference + case role + case securityLabel + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.detail = try [AuditEventEntityDetail](from: _container, forKeyIfPresent: .detail) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.lifecycle = try Coding(from: _container, forKeyIfPresent: .lifecycle) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.query = try FHIRPrimitive(from: _container, forKeyIfPresent: .query, auxiliaryKey: ._query) + self.reference = try Reference(from: _container, forKeyIfPresent: .reference) + self.role = try Coding(from: _container, forKeyIfPresent: .role) + self.securityLabel = try [Coding](from: _container, forKeyIfPresent: .securityLabel) + self.type = try Coding(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try detail?.encode(on: &_container, forKey: .detail) + try identifier?.encode(on: &_container, forKey: .identifier) + try lifecycle?.encode(on: &_container, forKey: .lifecycle) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try query?.encode(on: &_container, forKey: .query, auxiliaryKey: ._query) + try reference?.encode(on: &_container, forKey: .reference) + try role?.encode(on: &_container, forKey: .role) + try securityLabel?.encode(on: &_container, forKey: .securityLabel) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AuditEventEntity else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && detail == _other.detail + && identifier == _other.identifier + && lifecycle == _other.lifecycle + && name == _other.name + && query == _other.query + && reference == _other.reference + && role == _other.role + && securityLabel == _other.securityLabel + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(detail) + hasher.combine(identifier) + hasher.combine(lifecycle) + hasher.combine(name) + hasher.combine(query) + hasher.combine(reference) + hasher.combine(role) + hasher.combine(securityLabel) + hasher.combine(type) + } +} + +/** + Additional Information about the entity. + + Tagged value pairs for conveying additional information about the entity. + */ +open class AuditEventEntityDetail: BackboneElement { + + /// Name of the property + public var type: FHIRPrimitive + + /// Property value + public var value: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive, value: FHIRPrimitive) { + self.type = type + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: FHIRPrimitive, + value: FHIRPrimitive) + { + self.init(type: type, value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case type; case _type + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AuditEventEntityDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return type == _other.type + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(type) + hasher.combine(value) + } +} + +/** + Audit Event Reporter. + + The system that is reporting the event. + */ +open class AuditEventSource: BackboneElement { + + /// Logical source location within the enterprise + public var site: FHIRPrimitive? + + /// The identity of source detecting the event + public var identifier: Identifier + + /// The type of source where event originated + public var type: [Coding]? + + /// Designated initializer taking all required properties + public init(identifier: Identifier) { + self.identifier = identifier + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier, + modifierExtension: [Extension]? = nil, + site: FHIRPrimitive? = nil, + type: [Coding]? = nil) + { + self.init(identifier: identifier) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.site = site + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case identifier + case site; case _site + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.identifier = try Identifier(from: _container, forKey: .identifier) + self.site = try FHIRPrimitive(from: _container, forKeyIfPresent: .site, auxiliaryKey: ._site) + self.type = try [Coding](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try identifier.encode(on: &_container, forKey: .identifier) + try site?.encode(on: &_container, forKey: .site, auxiliaryKey: ._site) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? AuditEventSource else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return identifier == _other.identifier + && site == _other.site + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(identifier) + hasher.combine(site) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/BackboneElement.swift b/Sources/ModelsSTU3/BackboneElement.swift new file mode 100644 index 0000000..768e645 --- /dev/null +++ b/Sources/ModelsSTU3/BackboneElement.swift @@ -0,0 +1,89 @@ +// +// BackboneElement.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/BackboneElement) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Base for elements defined inside a resource. + + Base definition for all elements that are defined inside a resource - but not those in a data type. + */ +open class BackboneElement: Element { + + /// Extensions that cannot be ignored + public var modifierExtension: [Extension]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case modifierExtension + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.modifierExtension = try [Extension](from: _container, forKeyIfPresent: .modifierExtension) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try modifierExtension?.encode(on: &_container, forKey: .modifierExtension) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? BackboneElement else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return modifierExtension == _other.modifierExtension + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(modifierExtension) + } +} diff --git a/Sources/ModelsSTU3/Base64Binary.swift b/Sources/ModelsSTU3/Base64Binary.swift new file mode 100644 index 0000000..191bff2 --- /dev/null +++ b/Sources/ModelsSTU3/Base64Binary.swift @@ -0,0 +1,75 @@ +// +// Base64Binary.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import FMCore + +/** + A stream of bytes, base64 encoded (RFC 4648) + + http://hl7.org/fhir/datatypes.html#base64Binary + */ +public struct Base64Binary: FHIRPrimitiveType { + + public var dataString: String + + /** + Designated initializer. + */ + public init(_ dataString: String) { + self.dataString = dataString + } + + public init?(with data: Data) { + guard let string = String(data: data, encoding: .utf8) else { + return nil + } + self.dataString = string + } + + public func data(using encoding: String.Encoding = .utf8) -> Data? { + return dataString.data(using: encoding) + } +} + +extension Base64Binary: ExpressibleByStringLiteral { + + public init(stringLiteral value: StringLiteralType) { + self.init(value) + } +} + +extension Base64Binary: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + self.dataString = try container.decode(String.self) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(dataString) + } +} + +extension Base64Binary: Equatable { + + public static func ==(l: Base64Binary, r: Base64Binary) -> Bool { + return l.dataString == r.dataString + } +} diff --git a/Sources/ModelsSTU3/Basic.swift b/Sources/ModelsSTU3/Basic.swift new file mode 100644 index 0000000..1426266 --- /dev/null +++ b/Sources/ModelsSTU3/Basic.swift @@ -0,0 +1,144 @@ +// +// Basic.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Basic) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Resource for non-supported content. + + Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing + resource, and custom resources not appropriate for inclusion in the FHIR specification. + */ +open class Basic: DomainResource { + + override open class var resourceType: ResourceType { return .basic } + + /// Business identifier + public var identifier: [Identifier]? + + /// Kind of Resource + public var code: CodeableConcept + + /// Identifies the focus of this resource + public var subject: Reference? + + /// When created + public var created: FHIRPrimitive? + + /// Who created + public var author: Reference? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + author: Reference? = nil, + code: CodeableConcept, + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + subject: Reference? = nil, + text: Narrative? = nil) + { + self.init(code: code) + self.author = author + self.contained = contained + self.created = created + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.subject = subject + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case author + case code + case created; case _created + case identifier + case subject + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.author = try Reference(from: _container, forKeyIfPresent: .author) + self.code = try CodeableConcept(from: _container, forKey: .code) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try author?.encode(on: &_container, forKey: .author) + try code.encode(on: &_container, forKey: .code) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try identifier?.encode(on: &_container, forKey: .identifier) + try subject?.encode(on: &_container, forKey: .subject) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Basic else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return author == _other.author + && code == _other.code + && created == _other.created + && identifier == _other.identifier + && subject == _other.subject + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(author) + hasher.combine(code) + hasher.combine(created) + hasher.combine(identifier) + hasher.combine(subject) + } +} diff --git a/Sources/ModelsSTU3/Binary.swift b/Sources/ModelsSTU3/Binary.swift new file mode 100644 index 0000000..5cdd944 --- /dev/null +++ b/Sources/ModelsSTU3/Binary.swift @@ -0,0 +1,115 @@ +// +// Binary.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Binary) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Pure binary content defined by a format other than FHIR. + + A binary resource can contain any content, whether text, image, pdf, zip archive, etc. + */ +open class Binary: Resource { + + override open class var resourceType: ResourceType { return .binary } + + /// MimeType of the binary content + public var contentType: FHIRPrimitive + + /// Access Control Management + public var securityContext: Reference? + + /// The actual content + public var content: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(content: FHIRPrimitive, contentType: FHIRPrimitive) { + self.content = content + self.contentType = contentType + super.init() + } + + /// Convenience initializer + public convenience init( + content: FHIRPrimitive, + contentType: FHIRPrimitive, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + securityContext: Reference? = nil) + { + self.init(content: content, contentType: contentType) + self.id = id + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.securityContext = securityContext + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case content; case _content + case contentType; case _contentType + case securityContext + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.content = try FHIRPrimitive(from: _container, forKey: .content, auxiliaryKey: ._content) + self.contentType = try FHIRPrimitive(from: _container, forKey: .contentType, auxiliaryKey: ._contentType) + self.securityContext = try Reference(from: _container, forKeyIfPresent: .securityContext) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try content.encode(on: &_container, forKey: .content, auxiliaryKey: ._content) + try contentType.encode(on: &_container, forKey: .contentType, auxiliaryKey: ._contentType) + try securityContext?.encode(on: &_container, forKey: .securityContext) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Binary else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return content == _other.content + && contentType == _other.contentType + && securityContext == _other.securityContext + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(content) + hasher.combine(contentType) + hasher.combine(securityContext) + } +} diff --git a/Sources/ModelsSTU3/BodySite.swift b/Sources/ModelsSTU3/BodySite.swift new file mode 100644 index 0000000..63c7cb2 --- /dev/null +++ b/Sources/ModelsSTU3/BodySite.swift @@ -0,0 +1,164 @@ +// +// BodySite.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/BodySite) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Specific and identified anatomical location. + + Record details about the anatomical location of a specimen or body part. This resource may be used when a coded + concept does not provide the necessary detail needed for the use case. + */ +open class BodySite: DomainResource { + + override open class var resourceType: ResourceType { return .bodySite } + + /// Bodysite identifier + public var identifier: [Identifier]? + + /// Whether this body site record is in active use + public var active: FHIRPrimitive? + + /// Named anatomical location + public var code: CodeableConcept? + + /// Modification to location code + public var qualifier: [CodeableConcept]? + + /// Anatomical location description + public var description_fhir: FHIRPrimitive? + + /// Attached images + public var image: [Attachment]? + + /// Who this is about + public var patient: Reference + + /// Designated initializer taking all required properties + public init(patient: Reference) { + self.patient = patient + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + code: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + image: [Attachment]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + patient: Reference, + qualifier: [CodeableConcept]? = nil, + text: Narrative? = nil) + { + self.init(patient: patient) + self.active = active + self.code = code + self.contained = contained + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.image = image + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.qualifier = qualifier + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case code + case description_fhir = "description"; case _description_fhir = "_description" + case identifier + case image + case patient + case qualifier + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.image = try [Attachment](from: _container, forKeyIfPresent: .image) + self.patient = try Reference(from: _container, forKey: .patient) + self.qualifier = try [CodeableConcept](from: _container, forKeyIfPresent: .qualifier) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try code?.encode(on: &_container, forKey: .code) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try identifier?.encode(on: &_container, forKey: .identifier) + try image?.encode(on: &_container, forKey: .image) + try patient.encode(on: &_container, forKey: .patient) + try qualifier?.encode(on: &_container, forKey: .qualifier) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? BodySite else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && code == _other.code + && description_fhir == _other.description_fhir + && identifier == _other.identifier + && image == _other.image + && patient == _other.patient + && qualifier == _other.qualifier + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(code) + hasher.combine(description_fhir) + hasher.combine(identifier) + hasher.combine(image) + hasher.combine(patient) + hasher.combine(qualifier) + } +} diff --git a/Sources/ModelsSTU3/Bundle.swift b/Sources/ModelsSTU3/Bundle.swift new file mode 100644 index 0000000..b212d80 --- /dev/null +++ b/Sources/ModelsSTU3/Bundle.swift @@ -0,0 +1,661 @@ +// +// Bundle.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Bundle) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Contains a collection of resources. + + A container for a collection of resources. + */ +open class Bundle: Resource { + + override open class var resourceType: ResourceType { return .bundle } + + /// Persistent identifier for the bundle + public var identifier: Identifier? + + /// Indicates the purpose of this bundle - how it was intended to be used. + public var type: FHIRPrimitive + + /// If search, the total number of matches + public var total: FHIRPrimitive? + + /// Links related to this Bundle + public var link: [BundleLink]? + + /// Entry in the bundle - will have a resource, or information + public var entry: [BundleEntry]? + + /// Digital Signature + public var signature: Signature? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + entry: [BundleEntry]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + link: [BundleLink]? = nil, + meta: Meta? = nil, + signature: Signature? = nil, + total: FHIRPrimitive? = nil, + type: FHIRPrimitive) + { + self.init(type: type) + self.entry = entry + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.link = link + self.meta = meta + self.signature = signature + self.total = total + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case entry + case identifier + case link + case signature + case total; case _total + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.entry = try [BundleEntry](from: _container, forKeyIfPresent: .entry) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.link = try [BundleLink](from: _container, forKeyIfPresent: .link) + self.signature = try Signature(from: _container, forKeyIfPresent: .signature) + self.total = try FHIRPrimitive(from: _container, forKeyIfPresent: .total, auxiliaryKey: ._total) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try entry?.encode(on: &_container, forKey: .entry) + try identifier?.encode(on: &_container, forKey: .identifier) + try link?.encode(on: &_container, forKey: .link) + try signature?.encode(on: &_container, forKey: .signature) + try total?.encode(on: &_container, forKey: .total, auxiliaryKey: ._total) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Bundle else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return entry == _other.entry + && identifier == _other.identifier + && link == _other.link + && signature == _other.signature + && total == _other.total + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(entry) + hasher.combine(identifier) + hasher.combine(link) + hasher.combine(signature) + hasher.combine(total) + hasher.combine(type) + } +} + +/** + Entry in the bundle - will have a resource, or information. + + An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and + history only). + */ +open class BundleEntry: BackboneElement { + + /// Links related to this entry + public var link: [BundleLink]? + + /// Absolute URL for resource (server address, or UUID/OID) + public var fullUrl: FHIRPrimitive? + + /// A resource in the bundle + public var resource: ResourceProxy? + + /// Search related information + public var search: BundleEntrySearch? + + /// Transaction Related Information + public var request: BundleEntryRequest? + + /// Transaction Related Information + public var response: BundleEntryResponse? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + fullUrl: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + link: [BundleLink]? = nil, + modifierExtension: [Extension]? = nil, + request: BundleEntryRequest? = nil, + resource: ResourceProxy? = nil, + response: BundleEntryResponse? = nil, + search: BundleEntrySearch? = nil) + { + self.init() + self.`extension` = `extension` + self.fullUrl = fullUrl + self.id = id + self.link = link + self.modifierExtension = modifierExtension + self.request = request + self.resource = resource + self.response = response + self.search = search + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case fullUrl; case _fullUrl + case link + case request + case resource + case response + case search + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.fullUrl = try FHIRPrimitive(from: _container, forKeyIfPresent: .fullUrl, auxiliaryKey: ._fullUrl) + self.link = try [BundleLink](from: _container, forKeyIfPresent: .link) + self.request = try BundleEntryRequest(from: _container, forKeyIfPresent: .request) + self.resource = try ResourceProxy(from: _container, forKeyIfPresent: .resource) + self.response = try BundleEntryResponse(from: _container, forKeyIfPresent: .response) + self.search = try BundleEntrySearch(from: _container, forKeyIfPresent: .search) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try fullUrl?.encode(on: &_container, forKey: .fullUrl, auxiliaryKey: ._fullUrl) + try link?.encode(on: &_container, forKey: .link) + try request?.encode(on: &_container, forKey: .request) + try resource?.encode(on: &_container, forKey: .resource) + try response?.encode(on: &_container, forKey: .response) + try search?.encode(on: &_container, forKey: .search) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? BundleEntry else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return fullUrl == _other.fullUrl + && link == _other.link + && request == _other.request + && resource == _other.resource + && response == _other.response + && search == _other.search + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(fullUrl) + hasher.combine(link) + hasher.combine(request) + hasher.combine(resource) + hasher.combine(response) + hasher.combine(search) + } +} + +/** + Transaction Related Information. + + Additional information about how this entry should be processed as part of a transaction. + */ +open class BundleEntryRequest: BackboneElement { + + /// The HTTP verb for this entry in either a change history, or a transaction/ transaction response. + public var method: FHIRPrimitive + + /// URL for HTTP equivalent of this entry + public var url: FHIRPrimitive + + /// For managing cache currency + public var ifNoneMatch: FHIRPrimitive? + + /// For managing update contention + public var ifModifiedSince: FHIRPrimitive? + + /// For managing update contention + public var ifMatch: FHIRPrimitive? + + /// For conditional creates + public var ifNoneExist: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(method: FHIRPrimitive, url: FHIRPrimitive) { + self.method = method + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + ifMatch: FHIRPrimitive? = nil, + ifModifiedSince: FHIRPrimitive? = nil, + ifNoneExist: FHIRPrimitive? = nil, + ifNoneMatch: FHIRPrimitive? = nil, + method: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + url: FHIRPrimitive) + { + self.init(method: method, url: url) + self.`extension` = `extension` + self.id = id + self.ifMatch = ifMatch + self.ifModifiedSince = ifModifiedSince + self.ifNoneExist = ifNoneExist + self.ifNoneMatch = ifNoneMatch + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case ifMatch; case _ifMatch + case ifModifiedSince; case _ifModifiedSince + case ifNoneExist; case _ifNoneExist + case ifNoneMatch; case _ifNoneMatch + case method; case _method + case url; case _url + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.ifMatch = try FHIRPrimitive(from: _container, forKeyIfPresent: .ifMatch, auxiliaryKey: ._ifMatch) + self.ifModifiedSince = try FHIRPrimitive(from: _container, forKeyIfPresent: .ifModifiedSince, auxiliaryKey: ._ifModifiedSince) + self.ifNoneExist = try FHIRPrimitive(from: _container, forKeyIfPresent: .ifNoneExist, auxiliaryKey: ._ifNoneExist) + self.ifNoneMatch = try FHIRPrimitive(from: _container, forKeyIfPresent: .ifNoneMatch, auxiliaryKey: ._ifNoneMatch) + self.method = try FHIRPrimitive(from: _container, forKey: .method, auxiliaryKey: ._method) + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try ifMatch?.encode(on: &_container, forKey: .ifMatch, auxiliaryKey: ._ifMatch) + try ifModifiedSince?.encode(on: &_container, forKey: .ifModifiedSince, auxiliaryKey: ._ifModifiedSince) + try ifNoneExist?.encode(on: &_container, forKey: .ifNoneExist, auxiliaryKey: ._ifNoneExist) + try ifNoneMatch?.encode(on: &_container, forKey: .ifNoneMatch, auxiliaryKey: ._ifNoneMatch) + try method.encode(on: &_container, forKey: .method, auxiliaryKey: ._method) + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? BundleEntryRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return ifMatch == _other.ifMatch + && ifModifiedSince == _other.ifModifiedSince + && ifNoneExist == _other.ifNoneExist + && ifNoneMatch == _other.ifNoneMatch + && method == _other.method + && url == _other.url + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(ifMatch) + hasher.combine(ifModifiedSince) + hasher.combine(ifNoneExist) + hasher.combine(ifNoneMatch) + hasher.combine(method) + hasher.combine(url) + } +} + +/** + Transaction Related Information. + + Additional information about how this entry should be processed as part of a transaction. + */ +open class BundleEntryResponse: BackboneElement { + + /// Status response code (text optional) + public var status: FHIRPrimitive + + /// The location, if the operation returns a location + public var location: FHIRPrimitive? + + /// The etag for the resource (if relevant) + public var etag: FHIRPrimitive? + + /// Server's date time modified + public var lastModified: FHIRPrimitive? + + /// OperationOutcome with hints and warnings (for batch/transaction) + public var outcome: ResourceProxy? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + etag: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + lastModified: FHIRPrimitive? = nil, + location: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + outcome: ResourceProxy? = nil, + status: FHIRPrimitive) + { + self.init(status: status) + self.etag = etag + self.`extension` = `extension` + self.id = id + self.lastModified = lastModified + self.location = location + self.modifierExtension = modifierExtension + self.outcome = outcome + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case etag; case _etag + case lastModified; case _lastModified + case location; case _location + case outcome + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.etag = try FHIRPrimitive(from: _container, forKeyIfPresent: .etag, auxiliaryKey: ._etag) + self.lastModified = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastModified, auxiliaryKey: ._lastModified) + self.location = try FHIRPrimitive(from: _container, forKeyIfPresent: .location, auxiliaryKey: ._location) + self.outcome = try ResourceProxy(from: _container, forKeyIfPresent: .outcome) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try etag?.encode(on: &_container, forKey: .etag, auxiliaryKey: ._etag) + try lastModified?.encode(on: &_container, forKey: .lastModified, auxiliaryKey: ._lastModified) + try location?.encode(on: &_container, forKey: .location, auxiliaryKey: ._location) + try outcome?.encode(on: &_container, forKey: .outcome) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? BundleEntryResponse else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return etag == _other.etag + && lastModified == _other.lastModified + && location == _other.location + && outcome == _other.outcome + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(etag) + hasher.combine(lastModified) + hasher.combine(location) + hasher.combine(outcome) + hasher.combine(status) + } +} + +/** + Search related information. + + Information about the search process that lead to the creation of this entry. + */ +open class BundleEntrySearch: BackboneElement { + + /// Why this entry is in the result set - whether it's included as a match or because of an _include requirement. + public var mode: FHIRPrimitive? + + /// Search ranking (between 0 and 1) + public var score: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + mode: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + score: FHIRPrimitive? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.mode = mode + self.modifierExtension = modifierExtension + self.score = score + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case mode; case _mode + case score; case _score + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.mode = try FHIRPrimitive(from: _container, forKeyIfPresent: .mode, auxiliaryKey: ._mode) + self.score = try FHIRPrimitive(from: _container, forKeyIfPresent: .score, auxiliaryKey: ._score) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try mode?.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try score?.encode(on: &_container, forKey: .score, auxiliaryKey: ._score) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? BundleEntrySearch else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return mode == _other.mode + && score == _other.score + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(mode) + hasher.combine(score) + } +} + +/** + Links related to this Bundle. + + A series of links that provide context to this bundle. + */ +open class BundleLink: BackboneElement { + + /// See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1 + public var relation: FHIRPrimitive + + /// Reference details for the link + public var url: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(relation: FHIRPrimitive, url: FHIRPrimitive) { + self.relation = relation + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + relation: FHIRPrimitive, + url: FHIRPrimitive) + { + self.init(relation: relation, url: url) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case relation; case _relation + case url; case _url + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.relation = try FHIRPrimitive(from: _container, forKey: .relation, auxiliaryKey: ._relation) + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try relation.encode(on: &_container, forKey: .relation, auxiliaryKey: ._relation) + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? BundleLink else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return relation == _other.relation + && url == _other.url + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(relation) + hasher.combine(url) + } +} diff --git a/Sources/ModelsSTU3/CapabilityStatement.swift b/Sources/ModelsSTU3/CapabilityStatement.swift new file mode 100644 index 0000000..51a3a39 --- /dev/null +++ b/Sources/ModelsSTU3/CapabilityStatement.swift @@ -0,0 +1,1918 @@ +// +// CapabilityStatement.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CapabilityStatement) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A statement of system capabilities. + + A Capability Statement documents a set of capabilities (behaviors) of a FHIR Server that may be used as a statement of + actual server functionality or a statement of required or desired server implementation. + */ +open class CapabilityStatement: DomainResource { + + override open class var resourceType: ResourceType { return .capabilityStatement } + + /// Logical URI to reference this capability statement (globally unique) + public var url: FHIRPrimitive? + + /// Business version of the capability statement + public var version: FHIRPrimitive? + + /// Name for this capability statement (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this capability statement (human friendly) + public var title: FHIRPrimitive? + + /// The status of this capability statement. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the capability statement + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for capability statement (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Why this capability statement is defined + public var purpose: FHIRPrimitive? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// The way that this statement is intended to be used, to describe an actual running instance of software, a + /// particular product (kind not instance of software) or a class of implementation (e.g. a desired purchase). + public var kind: FHIRPrimitive + + /// Canonical URL of another capability statement this implements + public var instantiates: [FHIRPrimitive]? + + /// Software that is covered by this capability statement + public var software: CapabilityStatementSoftware? + + /// If this describes a specific instance + public var implementation: CapabilityStatementImplementation? + + /// FHIR Version the system uses + public var fhirVersion: FHIRPrimitive + + /// A code that indicates whether the application accepts unknown elements or extensions when reading resources. + public var acceptUnknown: FHIRPrimitive + + /// formats supported (xml | json | ttl | mime type) + public var format: [FHIRPrimitive] + + /// Patch formats supported + public var patchFormat: [FHIRPrimitive]? + + /// Implementation guides supported + public var implementationGuide: [FHIRPrimitive]? + + /// Profiles for use cases supported + public var profile: [Reference]? + + /// If the endpoint is a RESTful one + public var rest: [CapabilityStatementRest]? + + /// If messaging is supported + public var messaging: [CapabilityStatementMessaging]? + + /// Document definition + public var document: [CapabilityStatementDocument]? + + /// Designated initializer taking all required properties + public init(acceptUnknown: FHIRPrimitive, date: FHIRPrimitive, fhirVersion: FHIRPrimitive, format: [FHIRPrimitive], kind: FHIRPrimitive, status: FHIRPrimitive) { + self.acceptUnknown = acceptUnknown + self.date = date + self.fhirVersion = fhirVersion + self.format = format + self.kind = kind + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + acceptUnknown: FHIRPrimitive, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive, + description_fhir: FHIRPrimitive? = nil, + document: [CapabilityStatementDocument]? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + fhirVersion: FHIRPrimitive, + format: [FHIRPrimitive], + id: FHIRPrimitive? = nil, + implementation: CapabilityStatementImplementation? = nil, + implementationGuide: [FHIRPrimitive]? = nil, + implicitRules: FHIRPrimitive? = nil, + instantiates: [FHIRPrimitive]? = nil, + jurisdiction: [CodeableConcept]? = nil, + kind: FHIRPrimitive, + language: FHIRPrimitive? = nil, + messaging: [CapabilityStatementMessaging]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + patchFormat: [FHIRPrimitive]? = nil, + profile: [Reference]? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + rest: [CapabilityStatementRest]? = nil, + software: CapabilityStatementSoftware? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(acceptUnknown: acceptUnknown, date: date, fhirVersion: fhirVersion, format: format, kind: kind, status: status) + self.contact = contact + self.contained = contained + self.copyright = copyright + self.description_fhir = description_fhir + self.document = document + self.experimental = experimental + self.`extension` = `extension` + self.id = id + self.implementation = implementation + self.implementationGuide = implementationGuide + self.implicitRules = implicitRules + self.instantiates = instantiates + self.jurisdiction = jurisdiction + self.language = language + self.messaging = messaging + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.patchFormat = patchFormat + self.profile = profile + self.publisher = publisher + self.purpose = purpose + self.rest = rest + self.software = software + self.text = text + self.title = title + self.url = url + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case acceptUnknown; case _acceptUnknown + case contact + case copyright; case _copyright + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case document + case experimental; case _experimental + case fhirVersion; case _fhirVersion + case format; case _format + case implementation + case implementationGuide; case _implementationGuide + case instantiates; case _instantiates + case jurisdiction + case kind; case _kind + case messaging + case name; case _name + case patchFormat; case _patchFormat + case profile + case publisher; case _publisher + case purpose; case _purpose + case rest + case software + case status; case _status + case title; case _title + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.acceptUnknown = try FHIRPrimitive(from: _container, forKey: .acceptUnknown, auxiliaryKey: ._acceptUnknown) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKey: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.document = try [CapabilityStatementDocument](from: _container, forKeyIfPresent: .document) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.fhirVersion = try FHIRPrimitive(from: _container, forKey: .fhirVersion, auxiliaryKey: ._fhirVersion) + self.format = try [FHIRPrimitive](from: _container, forKey: .format, auxiliaryKey: ._format) + self.implementation = try CapabilityStatementImplementation(from: _container, forKeyIfPresent: .implementation) + self.implementationGuide = try [FHIRPrimitive](from: _container, forKeyIfPresent: .implementationGuide, auxiliaryKey: ._implementationGuide) + self.instantiates = try [FHIRPrimitive](from: _container, forKeyIfPresent: .instantiates, auxiliaryKey: ._instantiates) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.kind = try FHIRPrimitive(from: _container, forKey: .kind, auxiliaryKey: ._kind) + self.messaging = try [CapabilityStatementMessaging](from: _container, forKeyIfPresent: .messaging) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.patchFormat = try [FHIRPrimitive](from: _container, forKeyIfPresent: .patchFormat, auxiliaryKey: ._patchFormat) + self.profile = try [Reference](from: _container, forKeyIfPresent: .profile) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.rest = try [CapabilityStatementRest](from: _container, forKeyIfPresent: .rest) + self.software = try CapabilityStatementSoftware(from: _container, forKeyIfPresent: .software) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try acceptUnknown.encode(on: &_container, forKey: .acceptUnknown, auxiliaryKey: ._acceptUnknown) + try contact?.encode(on: &_container, forKey: .contact) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try document?.encode(on: &_container, forKey: .document) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try fhirVersion.encode(on: &_container, forKey: .fhirVersion, auxiliaryKey: ._fhirVersion) + try format.encode(on: &_container, forKey: .format, auxiliaryKey: ._format) + try implementation?.encode(on: &_container, forKey: .implementation) + try implementationGuide?.encode(on: &_container, forKey: .implementationGuide, auxiliaryKey: ._implementationGuide) + try instantiates?.encode(on: &_container, forKey: .instantiates, auxiliaryKey: ._instantiates) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try kind.encode(on: &_container, forKey: .kind, auxiliaryKey: ._kind) + try messaging?.encode(on: &_container, forKey: .messaging) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try patchFormat?.encode(on: &_container, forKey: .patchFormat, auxiliaryKey: ._patchFormat) + try profile?.encode(on: &_container, forKey: .profile) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try rest?.encode(on: &_container, forKey: .rest) + try software?.encode(on: &_container, forKey: .software) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatement else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return acceptUnknown == _other.acceptUnknown + && contact == _other.contact + && copyright == _other.copyright + && date == _other.date + && description_fhir == _other.description_fhir + && document == _other.document + && experimental == _other.experimental + && fhirVersion == _other.fhirVersion + && format == _other.format + && implementation == _other.implementation + && implementationGuide == _other.implementationGuide + && instantiates == _other.instantiates + && jurisdiction == _other.jurisdiction + && kind == _other.kind + && messaging == _other.messaging + && name == _other.name + && patchFormat == _other.patchFormat + && profile == _other.profile + && publisher == _other.publisher + && purpose == _other.purpose + && rest == _other.rest + && software == _other.software + && status == _other.status + && title == _other.title + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(acceptUnknown) + hasher.combine(contact) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(document) + hasher.combine(experimental) + hasher.combine(fhirVersion) + hasher.combine(format) + hasher.combine(implementation) + hasher.combine(implementationGuide) + hasher.combine(instantiates) + hasher.combine(jurisdiction) + hasher.combine(kind) + hasher.combine(messaging) + hasher.combine(name) + hasher.combine(patchFormat) + hasher.combine(profile) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(rest) + hasher.combine(software) + hasher.combine(status) + hasher.combine(title) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Document definition. + + A document definition. + */ +open class CapabilityStatementDocument: BackboneElement { + + /// Mode of this document declaration - whether an application is a producer or consumer. + public var mode: FHIRPrimitive + + /// Description of document support + public var documentation: FHIRPrimitive? + + /// Constraint on a resource used in the document + public var profile: Reference + + /// Designated initializer taking all required properties + public init(mode: FHIRPrimitive, profile: Reference) { + self.mode = mode + self.profile = profile + super.init() + } + + /// Convenience initializer + public convenience init( + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + mode: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + profile: Reference) + { + self.init(mode: mode, profile: profile) + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case documentation; case _documentation + case mode; case _mode + case profile + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.mode = try FHIRPrimitive(from: _container, forKey: .mode, auxiliaryKey: ._mode) + self.profile = try Reference(from: _container, forKey: .profile) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try mode.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try profile.encode(on: &_container, forKey: .profile) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementDocument else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return documentation == _other.documentation + && mode == _other.mode + && profile == _other.profile + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(documentation) + hasher.combine(mode) + hasher.combine(profile) + } +} + +/** + If this describes a specific instance. + + Identifies a specific implementation instance that is described by the capability statement - i.e. a particular + installation, rather than the capabilities of a software program. + */ +open class CapabilityStatementImplementation: BackboneElement { + + /// Describes this specific instance + public var description_fhir: FHIRPrimitive + + /// Base URL for the installation + public var url: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(description_fhir: FHIRPrimitive) { + self.description_fhir = description_fhir + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + url: FHIRPrimitive? = nil) + { + self.init(description_fhir: description_fhir) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.url = url + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case url; case _url + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementImplementation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && url == _other.url + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(url) + } +} + +/** + If messaging is supported. + + A description of the messaging capabilities of the solution. + */ +open class CapabilityStatementMessaging: BackboneElement { + + /// Where messages should be sent + public var endpoint: [CapabilityStatementMessagingEndpoint]? + + /// Reliable Message Cache Length (min) + public var reliableCache: FHIRPrimitive? + + /// Messaging interface behavior details + public var documentation: FHIRPrimitive? + + /// Messages supported by this system + public var supportedMessage: [CapabilityStatementMessagingSupportedMessage]? + + /// Declare support for this event + public var event: [CapabilityStatementMessagingEvent]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + documentation: FHIRPrimitive? = nil, + endpoint: [CapabilityStatementMessagingEndpoint]? = nil, + event: [CapabilityStatementMessagingEvent]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reliableCache: FHIRPrimitive? = nil, + supportedMessage: [CapabilityStatementMessagingSupportedMessage]? = nil) + { + self.init() + self.documentation = documentation + self.endpoint = endpoint + self.event = event + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reliableCache = reliableCache + self.supportedMessage = supportedMessage + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case documentation; case _documentation + case endpoint + case event + case reliableCache; case _reliableCache + case supportedMessage + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.endpoint = try [CapabilityStatementMessagingEndpoint](from: _container, forKeyIfPresent: .endpoint) + self.event = try [CapabilityStatementMessagingEvent](from: _container, forKeyIfPresent: .event) + self.reliableCache = try FHIRPrimitive(from: _container, forKeyIfPresent: .reliableCache, auxiliaryKey: ._reliableCache) + self.supportedMessage = try [CapabilityStatementMessagingSupportedMessage](from: _container, forKeyIfPresent: .supportedMessage) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try endpoint?.encode(on: &_container, forKey: .endpoint) + try event?.encode(on: &_container, forKey: .event) + try reliableCache?.encode(on: &_container, forKey: .reliableCache, auxiliaryKey: ._reliableCache) + try supportedMessage?.encode(on: &_container, forKey: .supportedMessage) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementMessaging else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return documentation == _other.documentation + && endpoint == _other.endpoint + && event == _other.event + && reliableCache == _other.reliableCache + && supportedMessage == _other.supportedMessage + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(documentation) + hasher.combine(endpoint) + hasher.combine(event) + hasher.combine(reliableCache) + hasher.combine(supportedMessage) + } +} + +/** + Where messages should be sent. + + An endpoint (network accessible address) to which messages and/or replies are to be sent. + */ +open class CapabilityStatementMessagingEndpoint: BackboneElement { + + /// http | ftp | mllp + + public var `protocol`: Coding + + /// Network address or identifier of the end-point + public var address: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(address: FHIRPrimitive, `protocol`: Coding) { + self.address = address + self.`protocol` = `protocol` + super.init() + } + + /// Convenience initializer + public convenience init( + address: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + `protocol`: Coding) + { + self.init(address: address, protocol: `protocol`) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case address; case _address + case `protocol` = "protocol" + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.address = try FHIRPrimitive(from: _container, forKey: .address, auxiliaryKey: ._address) + self.`protocol` = try Coding(from: _container, forKey: .`protocol`) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try address.encode(on: &_container, forKey: .address, auxiliaryKey: ._address) + try `protocol`.encode(on: &_container, forKey: .`protocol`) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementMessagingEndpoint else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return address == _other.address + && `protocol` == _other.`protocol` + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(address) + hasher.combine(`protocol`) + } +} + +/** + Declare support for this event. + + A description of the solution's support for an event at this end-point. + */ +open class CapabilityStatementMessagingEvent: BackboneElement { + + /// Event type + public var code: Coding + + /// The impact of the content of the message. + public var category: FHIRPrimitive? + + /// The mode of this event declaration - whether an application is a sender or receiver. + public var mode: FHIRPrimitive + + /// A resource associated with the event. This is the resource that defines the event. + public var focus: FHIRPrimitive + + /// Profile that describes the request + public var request: Reference + + /// Profile that describes the response + public var response: Reference + + /// Endpoint-specific event documentation + public var documentation: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(code: Coding, focus: FHIRPrimitive, mode: FHIRPrimitive, request: Reference, response: Reference) { + self.code = code + self.focus = focus + self.mode = mode + self.request = request + self.response = response + super.init() + } + + /// Convenience initializer + public convenience init( + category: FHIRPrimitive? = nil, + code: Coding, + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + focus: FHIRPrimitive, + id: FHIRPrimitive? = nil, + mode: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + request: Reference, + response: Reference) + { + self.init(code: code, focus: focus, mode: mode, request: request, response: response) + self.category = category + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category; case _category + case code + case documentation; case _documentation + case focus; case _focus + case mode; case _mode + case request + case response + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try FHIRPrimitive(from: _container, forKeyIfPresent: .category, auxiliaryKey: ._category) + self.code = try Coding(from: _container, forKey: .code) + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.focus = try FHIRPrimitive(from: _container, forKey: .focus, auxiliaryKey: ._focus) + self.mode = try FHIRPrimitive(from: _container, forKey: .mode, auxiliaryKey: ._mode) + self.request = try Reference(from: _container, forKey: .request) + self.response = try Reference(from: _container, forKey: .response) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category?.encode(on: &_container, forKey: .category, auxiliaryKey: ._category) + try code.encode(on: &_container, forKey: .code) + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try focus.encode(on: &_container, forKey: .focus, auxiliaryKey: ._focus) + try mode.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try request.encode(on: &_container, forKey: .request) + try response.encode(on: &_container, forKey: .response) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementMessagingEvent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && code == _other.code + && documentation == _other.documentation + && focus == _other.focus + && mode == _other.mode + && request == _other.request + && response == _other.response + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(code) + hasher.combine(documentation) + hasher.combine(focus) + hasher.combine(mode) + hasher.combine(request) + hasher.combine(response) + } +} + +/** + Messages supported by this system. + + References to message definitions for messages this system can send or receive. + */ +open class CapabilityStatementMessagingSupportedMessage: BackboneElement { + + /// The mode of this event declaration - whether application is sender or receiver. + public var mode: FHIRPrimitive + + /// Message supported by this system + public var definition: Reference + + /// Designated initializer taking all required properties + public init(definition: Reference, mode: FHIRPrimitive) { + self.definition = definition + self.mode = mode + super.init() + } + + /// Convenience initializer + public convenience init( + definition: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + mode: FHIRPrimitive, + modifierExtension: [Extension]? = nil) + { + self.init(definition: definition, mode: mode) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case definition + case mode; case _mode + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.definition = try Reference(from: _container, forKey: .definition) + self.mode = try FHIRPrimitive(from: _container, forKey: .mode, auxiliaryKey: ._mode) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try definition.encode(on: &_container, forKey: .definition) + try mode.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementMessagingSupportedMessage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return definition == _other.definition + && mode == _other.mode + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(definition) + hasher.combine(mode) + } +} + +/** + If the endpoint is a RESTful one. + + A definition of the restful capabilities of the solution, if any. + */ +open class CapabilityStatementRest: BackboneElement { + + /// Identifies whether this portion of the statement is describing the ability to initiate or receive restful + /// operations. + public var mode: FHIRPrimitive + + /// General description of implementation + public var documentation: FHIRPrimitive? + + /// Information about security of implementation + public var security: CapabilityStatementRestSecurity? + + /// Resource served on the REST interface + public var resource: [CapabilityStatementRestResource]? + + /// What operations are supported? + public var interaction: [CapabilityStatementRestInteraction]? + + /// Search parameters for searching all resources + public var searchParam: [CapabilityStatementRestResourceSearchParam]? + + /// Definition of an operation or a custom query + public var operation: [CapabilityStatementRestOperation]? + + /// Compartments served/used by system + public var compartment: [FHIRPrimitive]? + + /// Designated initializer taking all required properties + public init(mode: FHIRPrimitive) { + self.mode = mode + super.init() + } + + /// Convenience initializer + public convenience init( + compartment: [FHIRPrimitive]? = nil, + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + interaction: [CapabilityStatementRestInteraction]? = nil, + mode: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + operation: [CapabilityStatementRestOperation]? = nil, + resource: [CapabilityStatementRestResource]? = nil, + searchParam: [CapabilityStatementRestResourceSearchParam]? = nil, + security: CapabilityStatementRestSecurity? = nil) + { + self.init(mode: mode) + self.compartment = compartment + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.interaction = interaction + self.modifierExtension = modifierExtension + self.operation = operation + self.resource = resource + self.searchParam = searchParam + self.security = security + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case compartment; case _compartment + case documentation; case _documentation + case interaction + case mode; case _mode + case operation + case resource + case searchParam + case security + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.compartment = try [FHIRPrimitive](from: _container, forKeyIfPresent: .compartment, auxiliaryKey: ._compartment) + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.interaction = try [CapabilityStatementRestInteraction](from: _container, forKeyIfPresent: .interaction) + self.mode = try FHIRPrimitive(from: _container, forKey: .mode, auxiliaryKey: ._mode) + self.operation = try [CapabilityStatementRestOperation](from: _container, forKeyIfPresent: .operation) + self.resource = try [CapabilityStatementRestResource](from: _container, forKeyIfPresent: .resource) + self.searchParam = try [CapabilityStatementRestResourceSearchParam](from: _container, forKeyIfPresent: .searchParam) + self.security = try CapabilityStatementRestSecurity(from: _container, forKeyIfPresent: .security) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try compartment?.encode(on: &_container, forKey: .compartment, auxiliaryKey: ._compartment) + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try interaction?.encode(on: &_container, forKey: .interaction) + try mode.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try operation?.encode(on: &_container, forKey: .operation) + try resource?.encode(on: &_container, forKey: .resource) + try searchParam?.encode(on: &_container, forKey: .searchParam) + try security?.encode(on: &_container, forKey: .security) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementRest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return compartment == _other.compartment + && documentation == _other.documentation + && interaction == _other.interaction + && mode == _other.mode + && operation == _other.operation + && resource == _other.resource + && searchParam == _other.searchParam + && security == _other.security + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(compartment) + hasher.combine(documentation) + hasher.combine(interaction) + hasher.combine(mode) + hasher.combine(operation) + hasher.combine(resource) + hasher.combine(searchParam) + hasher.combine(security) + } +} + +/** + What operations are supported?. + + A specification of restful operations supported by the system. + */ +open class CapabilityStatementRestInteraction: BackboneElement { + + /// A coded identifier of the operation, supported by the system. + /// Restricted to: ['transaction', 'batch', 'search-system', 'history-system'] + public var code: FHIRPrimitive + + /// Anything special about operation behavior + public var documentation: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(code: code) + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case documentation; case _documentation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementRestInteraction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && documentation == _other.documentation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(documentation) + } +} + +/** + Definition of an operation or a custom query. + + Definition of an operation or a named query together with its parameters and their meaning and type. + */ +open class CapabilityStatementRestOperation: BackboneElement { + + /// Name by which the operation/query is invoked + public var name: FHIRPrimitive + + /// The defined operation/query + public var definition: Reference + + /// Designated initializer taking all required properties + public init(definition: Reference, name: FHIRPrimitive) { + self.definition = definition + self.name = name + super.init() + } + + /// Convenience initializer + public convenience init( + definition: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive) + { + self.init(definition: definition, name: name) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case definition + case name; case _name + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.definition = try Reference(from: _container, forKey: .definition) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try definition.encode(on: &_container, forKey: .definition) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementRestOperation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return definition == _other.definition + && name == _other.name + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(definition) + hasher.combine(name) + } +} + +/** + Resource served on the REST interface. + + A specification of the restful capabilities of the solution for a specific resource type. + */ +open class CapabilityStatementRestResource: BackboneElement { + + /// A type of resource exposed via the restful interface. + public var type: FHIRPrimitive + + /// Base System profile for all uses of resource + public var profile: Reference? + + /// Additional information about the use of the resource type + public var documentation: FHIRPrimitive? + + /// What operations are supported? + public var interaction: [CapabilityStatementRestResourceInteraction] + + /// This field is set to no-version to specify that the system does not support (server) or use (client) versioning + /// for this resource type. If this has some other value, the server must at least correctly track and populate the + /// versionId meta-property on resources. If the value is 'versioned-update', then the server supports all the + /// versioning features, including using e-tags for version integrity in the API. + public var versioning: FHIRPrimitive? + + /// Whether vRead can return past versions + public var readHistory: FHIRPrimitive? + + /// If update can commit to a new identity + public var updateCreate: FHIRPrimitive? + + /// If allows/uses conditional create + public var conditionalCreate: FHIRPrimitive? + + /// A code that indicates how the server supports conditional read. + public var conditionalRead: FHIRPrimitive? + + /// If allows/uses conditional update + public var conditionalUpdate: FHIRPrimitive? + + /// A code that indicates how the server supports conditional delete. + public var conditionalDelete: FHIRPrimitive? + + /// A set of flags that defines how references are supported. + public var referencePolicy: [FHIRPrimitive]? + + /// _include values supported by the server + public var searchInclude: [FHIRPrimitive]? + + /// _revinclude values supported by the server + public var searchRevInclude: [FHIRPrimitive]? + + /// Search parameters supported by implementation + public var searchParam: [CapabilityStatementRestResourceSearchParam]? + + /// Designated initializer taking all required properties + public init(interaction: [CapabilityStatementRestResourceInteraction], type: FHIRPrimitive) { + self.interaction = interaction + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + conditionalCreate: FHIRPrimitive? = nil, + conditionalDelete: FHIRPrimitive? = nil, + conditionalRead: FHIRPrimitive? = nil, + conditionalUpdate: FHIRPrimitive? = nil, + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + interaction: [CapabilityStatementRestResourceInteraction], + modifierExtension: [Extension]? = nil, + profile: Reference? = nil, + readHistory: FHIRPrimitive? = nil, + referencePolicy: [FHIRPrimitive]? = nil, + searchInclude: [FHIRPrimitive]? = nil, + searchParam: [CapabilityStatementRestResourceSearchParam]? = nil, + searchRevInclude: [FHIRPrimitive]? = nil, + type: FHIRPrimitive, + updateCreate: FHIRPrimitive? = nil, + versioning: FHIRPrimitive? = nil) + { + self.init(interaction: interaction, type: type) + self.conditionalCreate = conditionalCreate + self.conditionalDelete = conditionalDelete + self.conditionalRead = conditionalRead + self.conditionalUpdate = conditionalUpdate + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.profile = profile + self.readHistory = readHistory + self.referencePolicy = referencePolicy + self.searchInclude = searchInclude + self.searchParam = searchParam + self.searchRevInclude = searchRevInclude + self.updateCreate = updateCreate + self.versioning = versioning + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case conditionalCreate; case _conditionalCreate + case conditionalDelete; case _conditionalDelete + case conditionalRead; case _conditionalRead + case conditionalUpdate; case _conditionalUpdate + case documentation; case _documentation + case interaction + case profile + case readHistory; case _readHistory + case referencePolicy; case _referencePolicy + case searchInclude; case _searchInclude + case searchParam + case searchRevInclude; case _searchRevInclude + case type; case _type + case updateCreate; case _updateCreate + case versioning; case _versioning + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.conditionalCreate = try FHIRPrimitive(from: _container, forKeyIfPresent: .conditionalCreate, auxiliaryKey: ._conditionalCreate) + self.conditionalDelete = try FHIRPrimitive(from: _container, forKeyIfPresent: .conditionalDelete, auxiliaryKey: ._conditionalDelete) + self.conditionalRead = try FHIRPrimitive(from: _container, forKeyIfPresent: .conditionalRead, auxiliaryKey: ._conditionalRead) + self.conditionalUpdate = try FHIRPrimitive(from: _container, forKeyIfPresent: .conditionalUpdate, auxiliaryKey: ._conditionalUpdate) + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.interaction = try [CapabilityStatementRestResourceInteraction](from: _container, forKey: .interaction) + self.profile = try Reference(from: _container, forKeyIfPresent: .profile) + self.readHistory = try FHIRPrimitive(from: _container, forKeyIfPresent: .readHistory, auxiliaryKey: ._readHistory) + self.referencePolicy = try [FHIRPrimitive](from: _container, forKeyIfPresent: .referencePolicy, auxiliaryKey: ._referencePolicy) + self.searchInclude = try [FHIRPrimitive](from: _container, forKeyIfPresent: .searchInclude, auxiliaryKey: ._searchInclude) + self.searchParam = try [CapabilityStatementRestResourceSearchParam](from: _container, forKeyIfPresent: .searchParam) + self.searchRevInclude = try [FHIRPrimitive](from: _container, forKeyIfPresent: .searchRevInclude, auxiliaryKey: ._searchRevInclude) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.updateCreate = try FHIRPrimitive(from: _container, forKeyIfPresent: .updateCreate, auxiliaryKey: ._updateCreate) + self.versioning = try FHIRPrimitive(from: _container, forKeyIfPresent: .versioning, auxiliaryKey: ._versioning) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try conditionalCreate?.encode(on: &_container, forKey: .conditionalCreate, auxiliaryKey: ._conditionalCreate) + try conditionalDelete?.encode(on: &_container, forKey: .conditionalDelete, auxiliaryKey: ._conditionalDelete) + try conditionalRead?.encode(on: &_container, forKey: .conditionalRead, auxiliaryKey: ._conditionalRead) + try conditionalUpdate?.encode(on: &_container, forKey: .conditionalUpdate, auxiliaryKey: ._conditionalUpdate) + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try interaction.encode(on: &_container, forKey: .interaction) + try profile?.encode(on: &_container, forKey: .profile) + try readHistory?.encode(on: &_container, forKey: .readHistory, auxiliaryKey: ._readHistory) + try referencePolicy?.encode(on: &_container, forKey: .referencePolicy, auxiliaryKey: ._referencePolicy) + try searchInclude?.encode(on: &_container, forKey: .searchInclude, auxiliaryKey: ._searchInclude) + try searchParam?.encode(on: &_container, forKey: .searchParam) + try searchRevInclude?.encode(on: &_container, forKey: .searchRevInclude, auxiliaryKey: ._searchRevInclude) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try updateCreate?.encode(on: &_container, forKey: .updateCreate, auxiliaryKey: ._updateCreate) + try versioning?.encode(on: &_container, forKey: .versioning, auxiliaryKey: ._versioning) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementRestResource else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return conditionalCreate == _other.conditionalCreate + && conditionalDelete == _other.conditionalDelete + && conditionalRead == _other.conditionalRead + && conditionalUpdate == _other.conditionalUpdate + && documentation == _other.documentation + && interaction == _other.interaction + && profile == _other.profile + && readHistory == _other.readHistory + && referencePolicy == _other.referencePolicy + && searchInclude == _other.searchInclude + && searchParam == _other.searchParam + && searchRevInclude == _other.searchRevInclude + && type == _other.type + && updateCreate == _other.updateCreate + && versioning == _other.versioning + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(conditionalCreate) + hasher.combine(conditionalDelete) + hasher.combine(conditionalRead) + hasher.combine(conditionalUpdate) + hasher.combine(documentation) + hasher.combine(interaction) + hasher.combine(profile) + hasher.combine(readHistory) + hasher.combine(referencePolicy) + hasher.combine(searchInclude) + hasher.combine(searchParam) + hasher.combine(searchRevInclude) + hasher.combine(type) + hasher.combine(updateCreate) + hasher.combine(versioning) + } +} + +/** + What operations are supported?. + + Identifies a restful operation supported by the solution. + */ +open class CapabilityStatementRestResourceInteraction: BackboneElement { + + /// Coded identifier of the operation, supported by the system resource. + /// Restricted to: ['read', 'vread', 'update', 'patch', 'delete', 'history-instance', 'history-type', 'create', + /// 'search-type'] + public var code: FHIRPrimitive + + /// Anything special about operation behavior + public var documentation: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(code: code) + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case documentation; case _documentation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementRestResourceInteraction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && documentation == _other.documentation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(documentation) + } +} + +/** + Search parameters supported by implementation. + + Search parameters for implementations to support and/or make use of - either references to ones defined in the + specification, or additional ones defined for/by the implementation. + */ +open class CapabilityStatementRestResourceSearchParam: BackboneElement { + + /// Name of search parameter + public var name: FHIRPrimitive + + /// Source of definition for parameter + public var definition: FHIRPrimitive? + + /// The type of value a search parameter refers to, and how the content is interpreted. + public var type: FHIRPrimitive + + /// Server-specific usage + public var documentation: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive, type: FHIRPrimitive) { + self.name = name + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + definition: FHIRPrimitive? = nil, + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + type: FHIRPrimitive) + { + self.init(name: name, type: type) + self.definition = definition + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case definition; case _definition + case documentation; case _documentation + case name; case _name + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.definition = try FHIRPrimitive(from: _container, forKeyIfPresent: .definition, auxiliaryKey: ._definition) + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try definition?.encode(on: &_container, forKey: .definition, auxiliaryKey: ._definition) + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementRestResourceSearchParam else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return definition == _other.definition + && documentation == _other.documentation + && name == _other.name + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(definition) + hasher.combine(documentation) + hasher.combine(name) + hasher.combine(type) + } +} + +/** + Information about security of implementation. + + Information about security implementation from an interface perspective - what a client needs to know. + */ +open class CapabilityStatementRestSecurity: BackboneElement { + + /// Adds CORS Headers (http://enable-cors.org/) + public var cors: FHIRPrimitive? + + /// OAuth | SMART-on-FHIR | NTLM | Basic | Kerberos | Certificates + public var service: [CodeableConcept]? + + /// General description of how security works + public var description_fhir: FHIRPrimitive? + + /// Certificates associated with security profiles + public var certificate: [CapabilityStatementRestSecurityCertificate]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + certificate: [CapabilityStatementRestSecurityCertificate]? = nil, + cors: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + service: [CodeableConcept]? = nil) + { + self.init() + self.certificate = certificate + self.cors = cors + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.service = service + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case certificate + case cors; case _cors + case description_fhir = "description"; case _description_fhir = "_description" + case service + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.certificate = try [CapabilityStatementRestSecurityCertificate](from: _container, forKeyIfPresent: .certificate) + self.cors = try FHIRPrimitive(from: _container, forKeyIfPresent: .cors, auxiliaryKey: ._cors) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.service = try [CodeableConcept](from: _container, forKeyIfPresent: .service) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try certificate?.encode(on: &_container, forKey: .certificate) + try cors?.encode(on: &_container, forKey: .cors, auxiliaryKey: ._cors) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try service?.encode(on: &_container, forKey: .service) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementRestSecurity else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return certificate == _other.certificate + && cors == _other.cors + && description_fhir == _other.description_fhir + && service == _other.service + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(certificate) + hasher.combine(cors) + hasher.combine(description_fhir) + hasher.combine(service) + } +} + +/** + Certificates associated with security profiles. + */ +open class CapabilityStatementRestSecurityCertificate: BackboneElement { + + /// Mime type for certificates + public var type: FHIRPrimitive? + + /// Actual certificate + public var blob: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + blob: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: FHIRPrimitive? = nil) + { + self.init() + self.blob = blob + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case blob; case _blob + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.blob = try FHIRPrimitive(from: _container, forKeyIfPresent: .blob, auxiliaryKey: ._blob) + self.type = try FHIRPrimitive(from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try blob?.encode(on: &_container, forKey: .blob, auxiliaryKey: ._blob) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementRestSecurityCertificate else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return blob == _other.blob + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(blob) + hasher.combine(type) + } +} + +/** + Software that is covered by this capability statement. + + Software that is covered by this capability statement. It is used when the capability statement describes the + capabilities of a particular software version, independent of an installation. + */ +open class CapabilityStatementSoftware: BackboneElement { + + /// A name the software is known by + public var name: FHIRPrimitive + + /// Version covered by this statement + public var version: FHIRPrimitive? + + /// Date this version released + public var releaseDate: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive) { + self.name = name + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + releaseDate: FHIRPrimitive? = nil, + version: FHIRPrimitive? = nil) + { + self.init(name: name) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.releaseDate = releaseDate + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case name; case _name + case releaseDate; case _releaseDate + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.releaseDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .releaseDate, auxiliaryKey: ._releaseDate) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try releaseDate?.encode(on: &_container, forKey: .releaseDate, auxiliaryKey: ._releaseDate) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CapabilityStatementSoftware else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return name == _other.name + && releaseDate == _other.releaseDate + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(name) + hasher.combine(releaseDate) + hasher.combine(version) + } +} diff --git a/Sources/ModelsSTU3/CarePlan.swift b/Sources/ModelsSTU3/CarePlan.swift new file mode 100644 index 0000000..bb1347b --- /dev/null +++ b/Sources/ModelsSTU3/CarePlan.swift @@ -0,0 +1,696 @@ +// +// CarePlan.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CarePlan) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Healthcare plan for patient or group. + + Describes the intention of how one or more practitioners intend to deliver care for a particular patient, group or + community for a period of time, possibly limited to care for a specific condition or set of conditions. + */ +open class CarePlan: DomainResource { + + override open class var resourceType: ResourceType { return .carePlan } + + /// External Ids for this plan + public var identifier: [Identifier]? + + /// Protocol or definition + public var definition: [Reference]? + + /// Fulfills care plan + public var basedOn: [Reference]? + + /// CarePlan replaced by this CarePlan + public var replaces: [Reference]? + + /// Part of referenced CarePlan + public var partOf: [Reference]? + + /// Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical + /// record. + public var status: FHIRPrimitive + + /// Indicates the level of authority/intentionality associated with the care plan and where the care plan fits into + /// the workflow chain. + public var intent: FHIRPrimitive + + /// Type of plan + public var category: [CodeableConcept]? + + /// Human-friendly name for the CarePlan + public var title: FHIRPrimitive? + + /// Summary of nature of plan + public var description_fhir: FHIRPrimitive? + + /// Who care plan is for + public var subject: Reference + + /// Created in context of + public var context: Reference? + + /// Time period plan covers + public var period: Period? + + /// Who is responsible for contents of the plan + public var author: [Reference]? + + /// Who's involved in plan? + public var careTeam: [Reference]? + + /// Health issues this plan addresses + public var addresses: [Reference]? + + /// Information considered as part of plan + public var supportingInfo: [Reference]? + + /// Desired outcome of plan + public var goal: [Reference]? + + /// Action to occur as part of plan + public var activity: [CarePlanActivity]? + + /// Comments about the plan + public var note: [Annotation]? + + /// Designated initializer taking all required properties + public init(intent: FHIRPrimitive, status: FHIRPrimitive, subject: Reference) { + self.intent = intent + self.status = status + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + activity: [CarePlanActivity]? = nil, + addresses: [Reference]? = nil, + author: [Reference]? = nil, + basedOn: [Reference]? = nil, + careTeam: [Reference]? = nil, + category: [CodeableConcept]? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: [Reference]? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + goal: [Reference]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + intent: FHIRPrimitive, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + partOf: [Reference]? = nil, + period: Period? = nil, + replaces: [Reference]? = nil, + status: FHIRPrimitive, + subject: Reference, + supportingInfo: [Reference]? = nil, + text: Narrative? = nil, + title: FHIRPrimitive? = nil) + { + self.init(intent: intent, status: status, subject: subject) + self.activity = activity + self.addresses = addresses + self.author = author + self.basedOn = basedOn + self.careTeam = careTeam + self.category = category + self.contained = contained + self.context = context + self.definition = definition + self.description_fhir = description_fhir + self.`extension` = `extension` + self.goal = goal + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.partOf = partOf + self.period = period + self.replaces = replaces + self.supportingInfo = supportingInfo + self.text = text + self.title = title + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case activity + case addresses + case author + case basedOn + case careTeam + case category + case context + case definition + case description_fhir = "description"; case _description_fhir = "_description" + case goal + case identifier + case intent; case _intent + case note + case partOf + case period + case replaces + case status; case _status + case subject + case supportingInfo + case title; case _title + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.activity = try [CarePlanActivity](from: _container, forKeyIfPresent: .activity) + self.addresses = try [Reference](from: _container, forKeyIfPresent: .addresses) + self.author = try [Reference](from: _container, forKeyIfPresent: .author) + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.careTeam = try [Reference](from: _container, forKeyIfPresent: .careTeam) + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.definition = try [Reference](from: _container, forKeyIfPresent: .definition) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.goal = try [Reference](from: _container, forKeyIfPresent: .goal) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.intent = try FHIRPrimitive(from: _container, forKey: .intent, auxiliaryKey: ._intent) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.partOf = try [Reference](from: _container, forKeyIfPresent: .partOf) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.replaces = try [Reference](from: _container, forKeyIfPresent: .replaces) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.supportingInfo = try [Reference](from: _container, forKeyIfPresent: .supportingInfo) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try activity?.encode(on: &_container, forKey: .activity) + try addresses?.encode(on: &_container, forKey: .addresses) + try author?.encode(on: &_container, forKey: .author) + try basedOn?.encode(on: &_container, forKey: .basedOn) + try careTeam?.encode(on: &_container, forKey: .careTeam) + try category?.encode(on: &_container, forKey: .category) + try context?.encode(on: &_container, forKey: .context) + try definition?.encode(on: &_container, forKey: .definition) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try goal?.encode(on: &_container, forKey: .goal) + try identifier?.encode(on: &_container, forKey: .identifier) + try intent.encode(on: &_container, forKey: .intent, auxiliaryKey: ._intent) + try note?.encode(on: &_container, forKey: .note) + try partOf?.encode(on: &_container, forKey: .partOf) + try period?.encode(on: &_container, forKey: .period) + try replaces?.encode(on: &_container, forKey: .replaces) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try supportingInfo?.encode(on: &_container, forKey: .supportingInfo) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CarePlan else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return activity == _other.activity + && addresses == _other.addresses + && author == _other.author + && basedOn == _other.basedOn + && careTeam == _other.careTeam + && category == _other.category + && context == _other.context + && definition == _other.definition + && description_fhir == _other.description_fhir + && goal == _other.goal + && identifier == _other.identifier + && intent == _other.intent + && note == _other.note + && partOf == _other.partOf + && period == _other.period + && replaces == _other.replaces + && status == _other.status + && subject == _other.subject + && supportingInfo == _other.supportingInfo + && title == _other.title + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(activity) + hasher.combine(addresses) + hasher.combine(author) + hasher.combine(basedOn) + hasher.combine(careTeam) + hasher.combine(category) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(description_fhir) + hasher.combine(goal) + hasher.combine(identifier) + hasher.combine(intent) + hasher.combine(note) + hasher.combine(partOf) + hasher.combine(period) + hasher.combine(replaces) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(supportingInfo) + hasher.combine(title) + } +} + +/** + Action to occur as part of plan. + + Identifies a planned action to occur as part of the plan. For example, a medication to be used, lab tests to perform, + self-monitoring, education, etc. + */ +open class CarePlanActivity: BackboneElement { + + /// Results of the activity + public var outcomeCodeableConcept: [CodeableConcept]? + + /// Appointment, Encounter, Procedure, etc. + public var outcomeReference: [Reference]? + + /// Comments about the activity status/progress + public var progress: [Annotation]? + + /// Activity details defined in specific resource + public var reference: Reference? + + /// In-line definition of activity + public var detail: CarePlanActivityDetail? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + detail: CarePlanActivityDetail? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + outcomeCodeableConcept: [CodeableConcept]? = nil, + outcomeReference: [Reference]? = nil, + progress: [Annotation]? = nil, + reference: Reference? = nil) + { + self.init() + self.detail = detail + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.outcomeCodeableConcept = outcomeCodeableConcept + self.outcomeReference = outcomeReference + self.progress = progress + self.reference = reference + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case detail + case outcomeCodeableConcept + case outcomeReference + case progress + case reference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.detail = try CarePlanActivityDetail(from: _container, forKeyIfPresent: .detail) + self.outcomeCodeableConcept = try [CodeableConcept](from: _container, forKeyIfPresent: .outcomeCodeableConcept) + self.outcomeReference = try [Reference](from: _container, forKeyIfPresent: .outcomeReference) + self.progress = try [Annotation](from: _container, forKeyIfPresent: .progress) + self.reference = try Reference(from: _container, forKeyIfPresent: .reference) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try detail?.encode(on: &_container, forKey: .detail) + try outcomeCodeableConcept?.encode(on: &_container, forKey: .outcomeCodeableConcept) + try outcomeReference?.encode(on: &_container, forKey: .outcomeReference) + try progress?.encode(on: &_container, forKey: .progress) + try reference?.encode(on: &_container, forKey: .reference) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CarePlanActivity else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return detail == _other.detail + && outcomeCodeableConcept == _other.outcomeCodeableConcept + && outcomeReference == _other.outcomeReference + && progress == _other.progress + && reference == _other.reference + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(detail) + hasher.combine(outcomeCodeableConcept) + hasher.combine(outcomeReference) + hasher.combine(progress) + hasher.combine(reference) + } +} + +/** + In-line definition of activity. + + A simple summary of a planned activity suitable for a general care plan system (e.g. form driven) that doesn't know + about specific resources such as procedure etc. + */ +open class CarePlanActivityDetail: BackboneElement { + + /// All possible types for "product[x]" + public enum ProductX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// All possible types for "scheduled[x]" + public enum ScheduledX: Hashable { + case period(Period) + case string(FHIRPrimitive) + case timing(Timing) + } + + /// diet | drug | encounter | observation | procedure | supply | other + public var category: CodeableConcept? + + /// Protocol or definition + public var definition: Reference? + + /// Detail type of activity + public var code: CodeableConcept? + + /// Why activity should be done or why activity was prohibited + public var reasonCode: [CodeableConcept]? + + /// Condition triggering need for activity + public var reasonReference: [Reference]? + + /// Goals this activity relates to + public var goal: [Reference]? + + /// Identifies what progress is being made for the specific activity. + public var status: FHIRPrimitive + + /// Reason for current status + public var statusReason: FHIRPrimitive? + + /// Do NOT do + public var prohibited: FHIRPrimitive? + + /// When activity is to occur + /// One of `scheduled[x]` + public var scheduled: ScheduledX? + + /// Where it should happen + public var location: Reference? + + /// Who will be responsible? + public var performer: [Reference]? + + /// What is to be administered/supplied + /// One of `product[x]` + public var product: ProductX? + + /// How to consume/day? + public var dailyAmount: Quantity? + + /// How much to administer/supply/consume + public var quantity: Quantity? + + /// Extra info describing activity to perform + public var description_fhir: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + category: CodeableConcept? = nil, + code: CodeableConcept? = nil, + dailyAmount: Quantity? = nil, + definition: Reference? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + goal: [Reference]? = nil, + id: FHIRPrimitive? = nil, + location: Reference? = nil, + modifierExtension: [Extension]? = nil, + performer: [Reference]? = nil, + product: ProductX? = nil, + prohibited: FHIRPrimitive? = nil, + quantity: Quantity? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + scheduled: ScheduledX? = nil, + status: FHIRPrimitive, + statusReason: FHIRPrimitive? = nil) + { + self.init(status: status) + self.category = category + self.code = code + self.dailyAmount = dailyAmount + self.definition = definition + self.description_fhir = description_fhir + self.`extension` = `extension` + self.goal = goal + self.id = id + self.location = location + self.modifierExtension = modifierExtension + self.performer = performer + self.product = product + self.prohibited = prohibited + self.quantity = quantity + self.reasonCode = reasonCode + self.reasonReference = reasonReference + self.scheduled = scheduled + self.statusReason = statusReason + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category + case code + case dailyAmount + case definition + case description_fhir = "description"; case _description_fhir = "_description" + case goal + case location + case performer + case productCodeableConcept + case productReference + case prohibited; case _prohibited + case quantity + case reasonCode + case reasonReference + case scheduledPeriod + case scheduledString; case _scheduledString + case scheduledTiming + case status; case _status + case statusReason; case _statusReason + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.dailyAmount = try Quantity(from: _container, forKeyIfPresent: .dailyAmount) + self.definition = try Reference(from: _container, forKeyIfPresent: .definition) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.goal = try [Reference](from: _container, forKeyIfPresent: .goal) + self.location = try Reference(from: _container, forKeyIfPresent: .location) + self.performer = try [Reference](from: _container, forKeyIfPresent: .performer) + var _t_product: ProductX? = nil + if let productCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .productCodeableConcept) { + if _t_product != nil { + throw DecodingError.dataCorruptedError(forKey: .productCodeableConcept, in: _container, debugDescription: "More than one value provided for \"product\"") + } + _t_product = .codeableConcept(productCodeableConcept) + } + if let productReference = try Reference(from: _container, forKeyIfPresent: .productReference) { + if _t_product != nil { + throw DecodingError.dataCorruptedError(forKey: .productReference, in: _container, debugDescription: "More than one value provided for \"product\"") + } + _t_product = .reference(productReference) + } + self.product = _t_product + self.prohibited = try FHIRPrimitive(from: _container, forKeyIfPresent: .prohibited, auxiliaryKey: ._prohibited) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + var _t_scheduled: ScheduledX? = nil + if let scheduledTiming = try Timing(from: _container, forKeyIfPresent: .scheduledTiming) { + if _t_scheduled != nil { + throw DecodingError.dataCorruptedError(forKey: .scheduledTiming, in: _container, debugDescription: "More than one value provided for \"scheduled\"") + } + _t_scheduled = .timing(scheduledTiming) + } + if let scheduledPeriod = try Period(from: _container, forKeyIfPresent: .scheduledPeriod) { + if _t_scheduled != nil { + throw DecodingError.dataCorruptedError(forKey: .scheduledPeriod, in: _container, debugDescription: "More than one value provided for \"scheduled\"") + } + _t_scheduled = .period(scheduledPeriod) + } + if let scheduledString = try FHIRPrimitive(from: _container, forKeyIfPresent: .scheduledString, auxiliaryKey: ._scheduledString) { + if _t_scheduled != nil { + throw DecodingError.dataCorruptedError(forKey: .scheduledString, in: _container, debugDescription: "More than one value provided for \"scheduled\"") + } + _t_scheduled = .string(scheduledString) + } + self.scheduled = _t_scheduled + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.statusReason = try FHIRPrimitive(from: _container, forKeyIfPresent: .statusReason, auxiliaryKey: ._statusReason) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category?.encode(on: &_container, forKey: .category) + try code?.encode(on: &_container, forKey: .code) + try dailyAmount?.encode(on: &_container, forKey: .dailyAmount) + try definition?.encode(on: &_container, forKey: .definition) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try goal?.encode(on: &_container, forKey: .goal) + try location?.encode(on: &_container, forKey: .location) + try performer?.encode(on: &_container, forKey: .performer) + if let _enum = product { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .productCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .productReference) + } + } + try prohibited?.encode(on: &_container, forKey: .prohibited, auxiliaryKey: ._prohibited) + try quantity?.encode(on: &_container, forKey: .quantity) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + if let _enum = scheduled { + switch _enum { + case .timing(let _value): + try _value.encode(on: &_container, forKey: .scheduledTiming) + case .period(let _value): + try _value.encode(on: &_container, forKey: .scheduledPeriod) + case .string(let _value): + try _value.encode(on: &_container, forKey: .scheduledString, auxiliaryKey: ._scheduledString) + } + } + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try statusReason?.encode(on: &_container, forKey: .statusReason, auxiliaryKey: ._statusReason) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CarePlanActivityDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && code == _other.code + && dailyAmount == _other.dailyAmount + && definition == _other.definition + && description_fhir == _other.description_fhir + && goal == _other.goal + && location == _other.location + && performer == _other.performer + && product == _other.product + && prohibited == _other.prohibited + && quantity == _other.quantity + && reasonCode == _other.reasonCode + && reasonReference == _other.reasonReference + && scheduled == _other.scheduled + && status == _other.status + && statusReason == _other.statusReason + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(code) + hasher.combine(dailyAmount) + hasher.combine(definition) + hasher.combine(description_fhir) + hasher.combine(goal) + hasher.combine(location) + hasher.combine(performer) + hasher.combine(product) + hasher.combine(prohibited) + hasher.combine(quantity) + hasher.combine(reasonCode) + hasher.combine(reasonReference) + hasher.combine(scheduled) + hasher.combine(status) + hasher.combine(statusReason) + } +} diff --git a/Sources/ModelsSTU3/CareTeam.swift b/Sources/ModelsSTU3/CareTeam.swift new file mode 100644 index 0000000..63b0169 --- /dev/null +++ b/Sources/ModelsSTU3/CareTeam.swift @@ -0,0 +1,315 @@ +// +// CareTeam.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CareTeam) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Planned participants in the coordination and delivery of care for a patient or group. + + The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of + care for a patient. + */ +open class CareTeam: DomainResource { + + override open class var resourceType: ResourceType { return .careTeam } + + /// External Ids for this team + public var identifier: [Identifier]? + + /// Indicates the current state of the care team. + public var status: FHIRPrimitive? + + /// Type of team + public var category: [CodeableConcept]? + + /// Name of the team, such as crisis assessment team + public var name: FHIRPrimitive? + + /// Who care team is for + public var subject: Reference? + + /// Encounter or episode associated with CareTeam + public var context: Reference? + + /// Time period team covers + public var period: Period? + + /// Members of the team + public var participant: [CareTeamParticipant]? + + /// Why the care team exists + public var reasonCode: [CodeableConcept]? + + /// Why the care team exists + public var reasonReference: [Reference]? + + /// Organization responsible for the care team + public var managingOrganization: [Reference]? + + /// Comments made about the CareTeam + public var note: [Annotation]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + category: [CodeableConcept]? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + managingOrganization: [Reference]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + note: [Annotation]? = nil, + participant: [CareTeamParticipant]? = nil, + period: Period? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + status: FHIRPrimitive? = nil, + subject: Reference? = nil, + text: Narrative? = nil) + { + self.init() + self.category = category + self.contained = contained + self.context = context + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.managingOrganization = managingOrganization + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.note = note + self.participant = participant + self.period = period + self.reasonCode = reasonCode + self.reasonReference = reasonReference + self.status = status + self.subject = subject + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category + case context + case identifier + case managingOrganization + case name; case _name + case note + case participant + case period + case reasonCode + case reasonReference + case status; case _status + case subject + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.managingOrganization = try [Reference](from: _container, forKeyIfPresent: .managingOrganization) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.participant = try [CareTeamParticipant](from: _container, forKeyIfPresent: .participant) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category?.encode(on: &_container, forKey: .category) + try context?.encode(on: &_container, forKey: .context) + try identifier?.encode(on: &_container, forKey: .identifier) + try managingOrganization?.encode(on: &_container, forKey: .managingOrganization) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try note?.encode(on: &_container, forKey: .note) + try participant?.encode(on: &_container, forKey: .participant) + try period?.encode(on: &_container, forKey: .period) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CareTeam else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && context == _other.context + && identifier == _other.identifier + && managingOrganization == _other.managingOrganization + && name == _other.name + && note == _other.note + && participant == _other.participant + && period == _other.period + && reasonCode == _other.reasonCode + && reasonReference == _other.reasonReference + && status == _other.status + && subject == _other.subject + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(context) + hasher.combine(identifier) + hasher.combine(managingOrganization) + hasher.combine(name) + hasher.combine(note) + hasher.combine(participant) + hasher.combine(period) + hasher.combine(reasonCode) + hasher.combine(reasonReference) + hasher.combine(status) + hasher.combine(subject) + } +} + +/** + Members of the team. + + Identifies all people and organizations who are expected to be involved in the care team. + */ +open class CareTeamParticipant: BackboneElement { + + /// Type of involvement + public var role: CodeableConcept? + + /// Who is involved + public var member: Reference? + + /// Organization of the practitioner + public var onBehalfOf: Reference? + + /// Time period of participant + public var period: Period? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + member: Reference? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil, + period: Period? = nil, + role: CodeableConcept? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.member = member + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + self.period = period + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case member + case onBehalfOf + case period + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.member = try Reference(from: _container, forKeyIfPresent: .member) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try member?.encode(on: &_container, forKey: .member) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try period?.encode(on: &_container, forKey: .period) + try role?.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CareTeamParticipant else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return member == _other.member + && onBehalfOf == _other.onBehalfOf + && period == _other.period + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(member) + hasher.combine(onBehalfOf) + hasher.combine(period) + hasher.combine(role) + } +} diff --git a/Sources/ModelsSTU3/ChargeItem.swift b/Sources/ModelsSTU3/ChargeItem.swift new file mode 100644 index 0000000..4e5f179 --- /dev/null +++ b/Sources/ModelsSTU3/ChargeItem.swift @@ -0,0 +1,445 @@ +// +// ChargeItem.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ChargeItem) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Item containing charge code(s) associated with the provision of healthcare provider products. + + The resource ChargeItem describes the provision of healthcare provider products for a certain patient, therefore + referring not only to the product, but containing in addition details of the provision, like date, time, amounts and + participating organizations and persons. Main Usage of the ChargeItem is to enable the billing process and internal + cost allocation. + */ +open class ChargeItem: DomainResource { + + override open class var resourceType: ResourceType { return .chargeItem } + + /// All possible types for "occurrence[x]" + public enum OccurrenceX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + case timing(Timing) + } + + /// Business Identifier for item + public var identifier: Identifier? + + /// Defining information about the code of this charge item + public var definition: [FHIRPrimitive]? + + /// The current state of the ChargeItem. + public var status: FHIRPrimitive + + /// Part of referenced ChargeItem + public var partOf: [Reference]? + + /// A code that identifies the charge, like a billing code + public var code: CodeableConcept + + /// Individual service was done for/to + public var subject: Reference + + /// Encounter / Episode associated with event + public var context: Reference? + + /// When the charged service was applied + /// One of `occurrence[x]` + public var occurrence: OccurrenceX? + + /// Who performed charged service + public var participant: [ChargeItemParticipant]? + + /// Organization providing the charged sevice + public var performingOrganization: Reference? + + /// Organization requesting the charged service + public var requestingOrganization: Reference? + + /// Quantity of which the charge item has been serviced + public var quantity: Quantity? + + /// Anatomical location, if relevant + public var bodysite: [CodeableConcept]? + + /// Factor overriding the associated rules + public var factorOverride: FHIRPrimitive? + + /// Price overriding the associated rules + public var priceOverride: Money? + + /// Reason for overriding the list price/factor + public var overrideReason: FHIRPrimitive? + + /// Individual who was entering + public var enterer: Reference? + + /// Date the charge item was entered + public var enteredDate: FHIRPrimitive? + + /// Why was the charged service rendered? + public var reason: [CodeableConcept]? + + /// Which rendered service is being charged? + public var service: [Reference]? + + /// Account to place this charge + public var account: [Reference]? + + /// Comments made about the ChargeItem + public var note: [Annotation]? + + /// Further information supporting the this charge + public var supportingInformation: [Reference]? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept, status: FHIRPrimitive, subject: Reference) { + self.code = code + self.status = status + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + account: [Reference]? = nil, + bodysite: [CodeableConcept]? = nil, + code: CodeableConcept, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: [FHIRPrimitive]? = nil, + enteredDate: FHIRPrimitive? = nil, + enterer: Reference? = nil, + `extension`: [Extension]? = nil, + factorOverride: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + occurrence: OccurrenceX? = nil, + overrideReason: FHIRPrimitive? = nil, + partOf: [Reference]? = nil, + participant: [ChargeItemParticipant]? = nil, + performingOrganization: Reference? = nil, + priceOverride: Money? = nil, + quantity: Quantity? = nil, + reason: [CodeableConcept]? = nil, + requestingOrganization: Reference? = nil, + service: [Reference]? = nil, + status: FHIRPrimitive, + subject: Reference, + supportingInformation: [Reference]? = nil, + text: Narrative? = nil) + { + self.init(code: code, status: status, subject: subject) + self.account = account + self.bodysite = bodysite + self.contained = contained + self.context = context + self.definition = definition + self.enteredDate = enteredDate + self.enterer = enterer + self.`extension` = `extension` + self.factorOverride = factorOverride + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.occurrence = occurrence + self.overrideReason = overrideReason + self.partOf = partOf + self.participant = participant + self.performingOrganization = performingOrganization + self.priceOverride = priceOverride + self.quantity = quantity + self.reason = reason + self.requestingOrganization = requestingOrganization + self.service = service + self.supportingInformation = supportingInformation + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case account + case bodysite + case code + case context + case definition; case _definition + case enteredDate; case _enteredDate + case enterer + case factorOverride; case _factorOverride + case identifier + case note + case occurrenceDateTime; case _occurrenceDateTime + case occurrencePeriod + case occurrenceTiming + case overrideReason; case _overrideReason + case partOf + case participant + case performingOrganization + case priceOverride + case quantity + case reason + case requestingOrganization + case service + case status; case _status + case subject + case supportingInformation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.account = try [Reference](from: _container, forKeyIfPresent: .account) + self.bodysite = try [CodeableConcept](from: _container, forKeyIfPresent: .bodysite) + self.code = try CodeableConcept(from: _container, forKey: .code) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.definition = try [FHIRPrimitive](from: _container, forKeyIfPresent: .definition, auxiliaryKey: ._definition) + self.enteredDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .enteredDate, auxiliaryKey: ._enteredDate) + self.enterer = try Reference(from: _container, forKeyIfPresent: .enterer) + self.factorOverride = try FHIRPrimitive(from: _container, forKeyIfPresent: .factorOverride, auxiliaryKey: ._factorOverride) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + var _t_occurrence: OccurrenceX? = nil + if let occurrenceDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceDateTime, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .dateTime(occurrenceDateTime) + } + if let occurrencePeriod = try Period(from: _container, forKeyIfPresent: .occurrencePeriod) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrencePeriod, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .period(occurrencePeriod) + } + if let occurrenceTiming = try Timing(from: _container, forKeyIfPresent: .occurrenceTiming) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceTiming, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .timing(occurrenceTiming) + } + self.occurrence = _t_occurrence + self.overrideReason = try FHIRPrimitive(from: _container, forKeyIfPresent: .overrideReason, auxiliaryKey: ._overrideReason) + self.partOf = try [Reference](from: _container, forKeyIfPresent: .partOf) + self.participant = try [ChargeItemParticipant](from: _container, forKeyIfPresent: .participant) + self.performingOrganization = try Reference(from: _container, forKeyIfPresent: .performingOrganization) + self.priceOverride = try Money(from: _container, forKeyIfPresent: .priceOverride) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.reason = try [CodeableConcept](from: _container, forKeyIfPresent: .reason) + self.requestingOrganization = try Reference(from: _container, forKeyIfPresent: .requestingOrganization) + self.service = try [Reference](from: _container, forKeyIfPresent: .service) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.supportingInformation = try [Reference](from: _container, forKeyIfPresent: .supportingInformation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try account?.encode(on: &_container, forKey: .account) + try bodysite?.encode(on: &_container, forKey: .bodysite) + try code.encode(on: &_container, forKey: .code) + try context?.encode(on: &_container, forKey: .context) + try definition?.encode(on: &_container, forKey: .definition, auxiliaryKey: ._definition) + try enteredDate?.encode(on: &_container, forKey: .enteredDate, auxiliaryKey: ._enteredDate) + try enterer?.encode(on: &_container, forKey: .enterer) + try factorOverride?.encode(on: &_container, forKey: .factorOverride, auxiliaryKey: ._factorOverride) + try identifier?.encode(on: &_container, forKey: .identifier) + try note?.encode(on: &_container, forKey: .note) + if let _enum = occurrence { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .occurrencePeriod) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .occurrenceTiming) + } + } + try overrideReason?.encode(on: &_container, forKey: .overrideReason, auxiliaryKey: ._overrideReason) + try partOf?.encode(on: &_container, forKey: .partOf) + try participant?.encode(on: &_container, forKey: .participant) + try performingOrganization?.encode(on: &_container, forKey: .performingOrganization) + try priceOverride?.encode(on: &_container, forKey: .priceOverride) + try quantity?.encode(on: &_container, forKey: .quantity) + try reason?.encode(on: &_container, forKey: .reason) + try requestingOrganization?.encode(on: &_container, forKey: .requestingOrganization) + try service?.encode(on: &_container, forKey: .service) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try supportingInformation?.encode(on: &_container, forKey: .supportingInformation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ChargeItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return account == _other.account + && bodysite == _other.bodysite + && code == _other.code + && context == _other.context + && definition == _other.definition + && enteredDate == _other.enteredDate + && enterer == _other.enterer + && factorOverride == _other.factorOverride + && identifier == _other.identifier + && note == _other.note + && occurrence == _other.occurrence + && overrideReason == _other.overrideReason + && partOf == _other.partOf + && participant == _other.participant + && performingOrganization == _other.performingOrganization + && priceOverride == _other.priceOverride + && quantity == _other.quantity + && reason == _other.reason + && requestingOrganization == _other.requestingOrganization + && service == _other.service + && status == _other.status + && subject == _other.subject + && supportingInformation == _other.supportingInformation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(account) + hasher.combine(bodysite) + hasher.combine(code) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(enteredDate) + hasher.combine(enterer) + hasher.combine(factorOverride) + hasher.combine(identifier) + hasher.combine(note) + hasher.combine(occurrence) + hasher.combine(overrideReason) + hasher.combine(partOf) + hasher.combine(participant) + hasher.combine(performingOrganization) + hasher.combine(priceOverride) + hasher.combine(quantity) + hasher.combine(reason) + hasher.combine(requestingOrganization) + hasher.combine(service) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(supportingInformation) + } +} + +/** + Who performed charged service. + + Indicates who or what performed or participated in the charged service. + */ +open class ChargeItemParticipant: BackboneElement { + + /// What type of performance was done + public var role: CodeableConcept? + + /// Individual who was performing + public var actor: Reference + + /// Designated initializer taking all required properties + public init(actor: Reference) { + self.actor = actor + super.init() + } + + /// Convenience initializer + public convenience init( + actor: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + role: CodeableConcept? = nil) + { + self.init(actor: actor) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actor + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actor = try Reference(from: _container, forKey: .actor) + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actor.encode(on: &_container, forKey: .actor) + try role?.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ChargeItemParticipant else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actor == _other.actor + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actor) + hasher.combine(role) + } +} diff --git a/Sources/ModelsSTU3/Claim.swift b/Sources/ModelsSTU3/Claim.swift new file mode 100644 index 0000000..606b4d7 --- /dev/null +++ b/Sources/ModelsSTU3/Claim.swift @@ -0,0 +1,2075 @@ +// +// Claim.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Claim) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Claim, Pre-determination or Pre-authorization. + + A provider issued list of services and products provided, or to be provided, to a patient which is provided to an + insurer for payment recovery. + */ +open class Claim: DomainResource { + + override open class var resourceType: ResourceType { return .claim } + + /// Claim number + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// Type or discipline + public var type: CodeableConcept? + + /// Finer grained claim type information + public var subType: [CodeableConcept]? + + /// Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination). + public var use: FHIRPrimitive? + + /// The subject of the Products and Services + public var patient: Reference? + + /// Period for charge submission + public var billablePeriod: Period? + + /// Creation date + public var created: FHIRPrimitive? + + /// Author + public var enterer: Reference? + + /// Target + public var insurer: Reference? + + /// Responsible provider + public var provider: Reference? + + /// Responsible organization + public var organization: Reference? + + /// Desired processing priority + public var priority: CodeableConcept? + + /// Funds requested to be reserved + public var fundsReserve: CodeableConcept? + + /// Related Claims which may be revelant to processing this claimn + public var related: [ClaimRelated]? + + /// Prescription authorizing services or products + public var prescription: Reference? + + /// Original prescription if superceded by fulfiller + public var originalPrescription: Reference? + + /// Party to be paid any benefits payable + public var payee: ClaimPayee? + + /// Treatment Referral + public var referral: Reference? + + /// Servicing Facility + public var facility: Reference? + + /// Members of the care team + public var careTeam: [ClaimCareTeam]? + + /// Exceptions, special considerations, the condition, situation, prior or concurrent issues + public var information: [ClaimInformation]? + + /// List of Diagnosis + public var diagnosis: [ClaimDiagnosis]? + + /// Procedures performed + public var procedure: [ClaimProcedure]? + + /// Insurance or medical plan + public var insurance: [ClaimInsurance]? + + /// Details about an accident + public var accident: ClaimAccident? + + /// Period unable to work + public var employmentImpacted: Period? + + /// Period in hospital + public var hospitalization: Period? + + /// Goods and Services + public var item: [ClaimItem]? + + /// Total claim cost + public var total: Money? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + accident: ClaimAccident? = nil, + billablePeriod: Period? = nil, + careTeam: [ClaimCareTeam]? = nil, + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + diagnosis: [ClaimDiagnosis]? = nil, + employmentImpacted: Period? = nil, + enterer: Reference? = nil, + `extension`: [Extension]? = nil, + facility: Reference? = nil, + fundsReserve: CodeableConcept? = nil, + hospitalization: Period? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + information: [ClaimInformation]? = nil, + insurance: [ClaimInsurance]? = nil, + insurer: Reference? = nil, + item: [ClaimItem]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + organization: Reference? = nil, + originalPrescription: Reference? = nil, + patient: Reference? = nil, + payee: ClaimPayee? = nil, + prescription: Reference? = nil, + priority: CodeableConcept? = nil, + procedure: [ClaimProcedure]? = nil, + provider: Reference? = nil, + referral: Reference? = nil, + related: [ClaimRelated]? = nil, + status: FHIRPrimitive? = nil, + subType: [CodeableConcept]? = nil, + text: Narrative? = nil, + total: Money? = nil, + type: CodeableConcept? = nil, + use: FHIRPrimitive? = nil) + { + self.init() + self.accident = accident + self.billablePeriod = billablePeriod + self.careTeam = careTeam + self.contained = contained + self.created = created + self.diagnosis = diagnosis + self.employmentImpacted = employmentImpacted + self.enterer = enterer + self.`extension` = `extension` + self.facility = facility + self.fundsReserve = fundsReserve + self.hospitalization = hospitalization + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.information = information + self.insurance = insurance + self.insurer = insurer + self.item = item + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.organization = organization + self.originalPrescription = originalPrescription + self.patient = patient + self.payee = payee + self.prescription = prescription + self.priority = priority + self.procedure = procedure + self.provider = provider + self.referral = referral + self.related = related + self.status = status + self.subType = subType + self.text = text + self.total = total + self.type = type + self.use = use + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case accident + case billablePeriod + case careTeam + case created; case _created + case diagnosis + case employmentImpacted + case enterer + case facility + case fundsReserve + case hospitalization + case identifier + case information + case insurance + case insurer + case item + case organization + case originalPrescription + case patient + case payee + case prescription + case priority + case procedure + case provider + case referral + case related + case status; case _status + case subType + case total + case type + case use; case _use + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.accident = try ClaimAccident(from: _container, forKeyIfPresent: .accident) + self.billablePeriod = try Period(from: _container, forKeyIfPresent: .billablePeriod) + self.careTeam = try [ClaimCareTeam](from: _container, forKeyIfPresent: .careTeam) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.diagnosis = try [ClaimDiagnosis](from: _container, forKeyIfPresent: .diagnosis) + self.employmentImpacted = try Period(from: _container, forKeyIfPresent: .employmentImpacted) + self.enterer = try Reference(from: _container, forKeyIfPresent: .enterer) + self.facility = try Reference(from: _container, forKeyIfPresent: .facility) + self.fundsReserve = try CodeableConcept(from: _container, forKeyIfPresent: .fundsReserve) + self.hospitalization = try Period(from: _container, forKeyIfPresent: .hospitalization) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.information = try [ClaimInformation](from: _container, forKeyIfPresent: .information) + self.insurance = try [ClaimInsurance](from: _container, forKeyIfPresent: .insurance) + self.insurer = try Reference(from: _container, forKeyIfPresent: .insurer) + self.item = try [ClaimItem](from: _container, forKeyIfPresent: .item) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.originalPrescription = try Reference(from: _container, forKeyIfPresent: .originalPrescription) + self.patient = try Reference(from: _container, forKeyIfPresent: .patient) + self.payee = try ClaimPayee(from: _container, forKeyIfPresent: .payee) + self.prescription = try Reference(from: _container, forKeyIfPresent: .prescription) + self.priority = try CodeableConcept(from: _container, forKeyIfPresent: .priority) + self.procedure = try [ClaimProcedure](from: _container, forKeyIfPresent: .procedure) + self.provider = try Reference(from: _container, forKeyIfPresent: .provider) + self.referral = try Reference(from: _container, forKeyIfPresent: .referral) + self.related = try [ClaimRelated](from: _container, forKeyIfPresent: .related) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subType = try [CodeableConcept](from: _container, forKeyIfPresent: .subType) + self.total = try Money(from: _container, forKeyIfPresent: .total) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + self.use = try FHIRPrimitive(from: _container, forKeyIfPresent: .use, auxiliaryKey: ._use) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try accident?.encode(on: &_container, forKey: .accident) + try billablePeriod?.encode(on: &_container, forKey: .billablePeriod) + try careTeam?.encode(on: &_container, forKey: .careTeam) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try diagnosis?.encode(on: &_container, forKey: .diagnosis) + try employmentImpacted?.encode(on: &_container, forKey: .employmentImpacted) + try enterer?.encode(on: &_container, forKey: .enterer) + try facility?.encode(on: &_container, forKey: .facility) + try fundsReserve?.encode(on: &_container, forKey: .fundsReserve) + try hospitalization?.encode(on: &_container, forKey: .hospitalization) + try identifier?.encode(on: &_container, forKey: .identifier) + try information?.encode(on: &_container, forKey: .information) + try insurance?.encode(on: &_container, forKey: .insurance) + try insurer?.encode(on: &_container, forKey: .insurer) + try item?.encode(on: &_container, forKey: .item) + try organization?.encode(on: &_container, forKey: .organization) + try originalPrescription?.encode(on: &_container, forKey: .originalPrescription) + try patient?.encode(on: &_container, forKey: .patient) + try payee?.encode(on: &_container, forKey: .payee) + try prescription?.encode(on: &_container, forKey: .prescription) + try priority?.encode(on: &_container, forKey: .priority) + try procedure?.encode(on: &_container, forKey: .procedure) + try provider?.encode(on: &_container, forKey: .provider) + try referral?.encode(on: &_container, forKey: .referral) + try related?.encode(on: &_container, forKey: .related) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subType?.encode(on: &_container, forKey: .subType) + try total?.encode(on: &_container, forKey: .total) + try type?.encode(on: &_container, forKey: .type) + try use?.encode(on: &_container, forKey: .use, auxiliaryKey: ._use) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Claim else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return accident == _other.accident + && billablePeriod == _other.billablePeriod + && careTeam == _other.careTeam + && created == _other.created + && diagnosis == _other.diagnosis + && employmentImpacted == _other.employmentImpacted + && enterer == _other.enterer + && facility == _other.facility + && fundsReserve == _other.fundsReserve + && hospitalization == _other.hospitalization + && identifier == _other.identifier + && information == _other.information + && insurance == _other.insurance + && insurer == _other.insurer + && item == _other.item + && organization == _other.organization + && originalPrescription == _other.originalPrescription + && patient == _other.patient + && payee == _other.payee + && prescription == _other.prescription + && priority == _other.priority + && procedure == _other.procedure + && provider == _other.provider + && referral == _other.referral + && related == _other.related + && status == _other.status + && subType == _other.subType + && total == _other.total + && type == _other.type + && use == _other.use + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(accident) + hasher.combine(billablePeriod) + hasher.combine(careTeam) + hasher.combine(created) + hasher.combine(diagnosis) + hasher.combine(employmentImpacted) + hasher.combine(enterer) + hasher.combine(facility) + hasher.combine(fundsReserve) + hasher.combine(hospitalization) + hasher.combine(identifier) + hasher.combine(information) + hasher.combine(insurance) + hasher.combine(insurer) + hasher.combine(item) + hasher.combine(organization) + hasher.combine(originalPrescription) + hasher.combine(patient) + hasher.combine(payee) + hasher.combine(prescription) + hasher.combine(priority) + hasher.combine(procedure) + hasher.combine(provider) + hasher.combine(referral) + hasher.combine(related) + hasher.combine(status) + hasher.combine(subType) + hasher.combine(total) + hasher.combine(type) + hasher.combine(use) + } +} + +/** + Details about an accident. + + An accident which resulted in the need for healthcare services. + */ +open class ClaimAccident: BackboneElement { + + /// All possible types for "location[x]" + public enum LocationX: Hashable { + case address(Address) + case reference(Reference) + } + + /// When the accident occurred + /// see information codes + /// see information codes + public var date: FHIRPrimitive + + /// The nature of the accident + public var type: CodeableConcept? + + /// Accident Place + /// One of `location[x]` + public var location: LocationX? + + /// Designated initializer taking all required properties + public init(date: FHIRPrimitive) { + self.date = date + super.init() + } + + /// Convenience initializer + public convenience init( + date: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + location: LocationX? = nil, + modifierExtension: [Extension]? = nil, + type: CodeableConcept? = nil) + { + self.init(date: date) + self.`extension` = `extension` + self.id = id + self.location = location + self.modifierExtension = modifierExtension + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case date; case _date + case locationAddress + case locationReference + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.date = try FHIRPrimitive(from: _container, forKey: .date, auxiliaryKey: ._date) + var _t_location: LocationX? = nil + if let locationAddress = try Address(from: _container, forKeyIfPresent: .locationAddress) { + if _t_location != nil { + throw DecodingError.dataCorruptedError(forKey: .locationAddress, in: _container, debugDescription: "More than one value provided for \"location\"") + } + _t_location = .address(locationAddress) + } + if let locationReference = try Reference(from: _container, forKeyIfPresent: .locationReference) { + if _t_location != nil { + throw DecodingError.dataCorruptedError(forKey: .locationReference, in: _container, debugDescription: "More than one value provided for \"location\"") + } + _t_location = .reference(locationReference) + } + self.location = _t_location + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try date.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + if let _enum = location { + switch _enum { + case .address(let _value): + try _value.encode(on: &_container, forKey: .locationAddress) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .locationReference) + } + } + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimAccident else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return date == _other.date + && location == _other.location + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(date) + hasher.combine(location) + hasher.combine(type) + } +} + +/** + Members of the care team. + + The members of the team who provided the overall service as well as their role and whether responsible and + qualifications. + */ +open class ClaimCareTeam: BackboneElement { + + /// Number to covey order of careTeam + public var sequence: FHIRPrimitive + + /// Provider individual or organization + public var provider: Reference + + /// Billing provider + public var responsible: FHIRPrimitive? + + /// Role on the team + public var role: CodeableConcept? + + /// Type, classification or Specialization + public var qualification: CodeableConcept? + + /// Designated initializer taking all required properties + public init(provider: Reference, sequence: FHIRPrimitive) { + self.provider = provider + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + provider: Reference, + qualification: CodeableConcept? = nil, + responsible: FHIRPrimitive? = nil, + role: CodeableConcept? = nil, + sequence: FHIRPrimitive) + { + self.init(provider: provider, sequence: sequence) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.qualification = qualification + self.responsible = responsible + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case provider + case qualification + case responsible; case _responsible + case role + case sequence; case _sequence + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.provider = try Reference(from: _container, forKey: .provider) + self.qualification = try CodeableConcept(from: _container, forKeyIfPresent: .qualification) + self.responsible = try FHIRPrimitive(from: _container, forKeyIfPresent: .responsible, auxiliaryKey: ._responsible) + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try provider.encode(on: &_container, forKey: .provider) + try qualification?.encode(on: &_container, forKey: .qualification) + try responsible?.encode(on: &_container, forKey: .responsible, auxiliaryKey: ._responsible) + try role?.encode(on: &_container, forKey: .role) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimCareTeam else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return provider == _other.provider + && qualification == _other.qualification + && responsible == _other.responsible + && role == _other.role + && sequence == _other.sequence + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(provider) + hasher.combine(qualification) + hasher.combine(responsible) + hasher.combine(role) + hasher.combine(sequence) + } +} + +/** + List of Diagnosis. + + List of patient diagnosis for which care is sought. + */ +open class ClaimDiagnosis: BackboneElement { + + /// All possible types for "diagnosis[x]" + public enum DiagnosisX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Number to covey order of diagnosis + public var sequence: FHIRPrimitive + + /// Patient's diagnosis + /// One of `diagnosis[x]` + public var diagnosis: DiagnosisX + + /// Timing or nature of the diagnosis + public var type: [CodeableConcept]? + + /// Package billing code + public var packageCode: CodeableConcept? + + /// Designated initializer taking all required properties + public init(diagnosis: DiagnosisX, sequence: FHIRPrimitive) { + self.diagnosis = diagnosis + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + diagnosis: DiagnosisX, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + packageCode: CodeableConcept? = nil, + sequence: FHIRPrimitive, + type: [CodeableConcept]? = nil) + { + self.init(diagnosis: diagnosis, sequence: sequence) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.packageCode = packageCode + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case diagnosisCodeableConcept + case diagnosisReference + case packageCode + case sequence; case _sequence + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.diagnosisCodeableConcept) || _container.contains(CodingKeys.diagnosisReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.diagnosisCodeableConcept, CodingKeys.diagnosisReference], debugDescription: "Must have at least one value for \"diagnosis\" but have none")) + } + + // Decode all our properties + var _t_diagnosis: DiagnosisX? = nil + if let diagnosisCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .diagnosisCodeableConcept) { + if _t_diagnosis != nil { + throw DecodingError.dataCorruptedError(forKey: .diagnosisCodeableConcept, in: _container, debugDescription: "More than one value provided for \"diagnosis\"") + } + _t_diagnosis = .codeableConcept(diagnosisCodeableConcept) + } + if let diagnosisReference = try Reference(from: _container, forKeyIfPresent: .diagnosisReference) { + if _t_diagnosis != nil { + throw DecodingError.dataCorruptedError(forKey: .diagnosisReference, in: _container, debugDescription: "More than one value provided for \"diagnosis\"") + } + _t_diagnosis = .reference(diagnosisReference) + } + self.diagnosis = _t_diagnosis! + self.packageCode = try CodeableConcept(from: _container, forKeyIfPresent: .packageCode) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + self.type = try [CodeableConcept](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + + switch diagnosis { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .diagnosisCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .diagnosisReference) + } + + try packageCode?.encode(on: &_container, forKey: .packageCode) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimDiagnosis else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return diagnosis == _other.diagnosis + && packageCode == _other.packageCode + && sequence == _other.sequence + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(diagnosis) + hasher.combine(packageCode) + hasher.combine(sequence) + hasher.combine(type) + } +} + +/** + Exceptions, special considerations, the condition, situation, prior or concurrent issues. + + Additional information codes regarding exceptions, special considerations, the condition, situation, prior or + concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required. + */ +open class ClaimInformation: BackboneElement { + + /// All possible types for "timing[x]" + public enum TimingX: Hashable { + case date(FHIRPrimitive) + case period(Period) + } + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case attachment(Attachment) + case quantity(Quantity) + case reference(Reference) + case string(FHIRPrimitive) + } + + /// Information instance identifier + public var sequence: FHIRPrimitive + + /// General class of information + public var category: CodeableConcept + + /// Type of information + public var code: CodeableConcept? + + /// When it occurred + /// One of `timing[x]` + public var timing: TimingX? + + /// Additional Data or supporting information + /// One of `value[x]` + public var value: ValueX? + + /// Reason associated with the information + public var reason: CodeableConcept? + + /// Designated initializer taking all required properties + public init(category: CodeableConcept, sequence: FHIRPrimitive) { + self.category = category + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + category: CodeableConcept, + code: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reason: CodeableConcept? = nil, + sequence: FHIRPrimitive, + timing: TimingX? = nil, + value: ValueX? = nil) + { + self.init(category: category, sequence: sequence) + self.code = code + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reason = reason + self.timing = timing + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category + case code + case reason + case sequence; case _sequence + case timingDate; case _timingDate + case timingPeriod + case valueAttachment + case valueQuantity + case valueReference + case valueString; case _valueString + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try CodeableConcept(from: _container, forKey: .category) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.reason = try CodeableConcept(from: _container, forKeyIfPresent: .reason) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + var _t_timing: TimingX? = nil + if let timingDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .timingDate, auxiliaryKey: ._timingDate) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingDate, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .date(timingDate) + } + if let timingPeriod = try Period(from: _container, forKeyIfPresent: .timingPeriod) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingPeriod, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .period(timingPeriod) + } + self.timing = _t_timing + var _t_value: ValueX? = nil + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueAttachment = try Attachment(from: _container, forKeyIfPresent: .valueAttachment) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAttachment, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .attachment(valueAttachment) + } + if let valueReference = try Reference(from: _container, forKeyIfPresent: .valueReference) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueReference, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .reference(valueReference) + } + self.value = _t_value + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category.encode(on: &_container, forKey: .category) + try code?.encode(on: &_container, forKey: .code) + try reason?.encode(on: &_container, forKey: .reason) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + if let _enum = timing { + switch _enum { + case .date(let _value): + try _value.encode(on: &_container, forKey: .timingDate, auxiliaryKey: ._timingDate) + case .period(let _value): + try _value.encode(on: &_container, forKey: .timingPeriod) + } + } + if let _enum = value { + switch _enum { + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .valueAttachment) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueReference) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimInformation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && code == _other.code + && reason == _other.reason + && sequence == _other.sequence + && timing == _other.timing + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(code) + hasher.combine(reason) + hasher.combine(sequence) + hasher.combine(timing) + hasher.combine(value) + } +} + +/** + Insurance or medical plan. + + Financial instrument by which payment information for health care. + */ +open class ClaimInsurance: BackboneElement { + + /// Service instance identifier + public var sequence: FHIRPrimitive + + /// Is the focal Coverage + public var focal: FHIRPrimitive + + /// Insurance information + public var coverage: Reference + + /// Business agreement + public var businessArrangement: FHIRPrimitive? + + /// Pre-Authorization/Determination Reference + public var preAuthRef: [FHIRPrimitive]? + + /// Adjudication results + public var claimResponse: Reference? + + /// Designated initializer taking all required properties + public init(coverage: Reference, focal: FHIRPrimitive, sequence: FHIRPrimitive) { + self.coverage = coverage + self.focal = focal + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + businessArrangement: FHIRPrimitive? = nil, + claimResponse: Reference? = nil, + coverage: Reference, + `extension`: [Extension]? = nil, + focal: FHIRPrimitive, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + preAuthRef: [FHIRPrimitive]? = nil, + sequence: FHIRPrimitive) + { + self.init(coverage: coverage, focal: focal, sequence: sequence) + self.businessArrangement = businessArrangement + self.claimResponse = claimResponse + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.preAuthRef = preAuthRef + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case businessArrangement; case _businessArrangement + case claimResponse + case coverage + case focal; case _focal + case preAuthRef; case _preAuthRef + case sequence; case _sequence + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.businessArrangement = try FHIRPrimitive(from: _container, forKeyIfPresent: .businessArrangement, auxiliaryKey: ._businessArrangement) + self.claimResponse = try Reference(from: _container, forKeyIfPresent: .claimResponse) + self.coverage = try Reference(from: _container, forKey: .coverage) + self.focal = try FHIRPrimitive(from: _container, forKey: .focal, auxiliaryKey: ._focal) + self.preAuthRef = try [FHIRPrimitive](from: _container, forKeyIfPresent: .preAuthRef, auxiliaryKey: ._preAuthRef) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try businessArrangement?.encode(on: &_container, forKey: .businessArrangement, auxiliaryKey: ._businessArrangement) + try claimResponse?.encode(on: &_container, forKey: .claimResponse) + try coverage.encode(on: &_container, forKey: .coverage) + try focal.encode(on: &_container, forKey: .focal, auxiliaryKey: ._focal) + try preAuthRef?.encode(on: &_container, forKey: .preAuthRef, auxiliaryKey: ._preAuthRef) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimInsurance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return businessArrangement == _other.businessArrangement + && claimResponse == _other.claimResponse + && coverage == _other.coverage + && focal == _other.focal + && preAuthRef == _other.preAuthRef + && sequence == _other.sequence + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(businessArrangement) + hasher.combine(claimResponse) + hasher.combine(coverage) + hasher.combine(focal) + hasher.combine(preAuthRef) + hasher.combine(sequence) + } +} + +/** + Goods and Services. + + First tier of goods and services. + */ +open class ClaimItem: BackboneElement { + + /// All possible types for "location[x]" + public enum LocationX: Hashable { + case address(Address) + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// All possible types for "serviced[x]" + public enum ServicedX: Hashable { + case date(FHIRPrimitive) + case period(Period) + } + + /// Service instance + public var sequence: FHIRPrimitive + + /// Applicable careTeam members + public var careTeamLinkId: [FHIRPrimitive]? + + /// Applicable diagnoses + public var diagnosisLinkId: [FHIRPrimitive]? + + /// Applicable procedures + public var procedureLinkId: [FHIRPrimitive]? + + /// Applicable exception and supporting information + public var informationLinkId: [FHIRPrimitive]? + + /// Revenue or cost center code + public var revenue: CodeableConcept? + + /// Type of service or product + public var category: CodeableConcept? + + /// Billing Code + public var service: CodeableConcept? + + /// Service/Product billing modifiers + public var modifier: [CodeableConcept]? + + /// Program specific reason for item inclusion + public var programCode: [CodeableConcept]? + + /// Date or dates of Service + /// One of `serviced[x]` + public var serviced: ServicedX? + + /// Place of service + /// One of `location[x]` + public var location: LocationX? + + /// Count of Products or Services + public var quantity: Quantity? + + /// Fee, charge or cost per point + public var unitPrice: Money? + + /// Price scaling factor + public var factor: FHIRPrimitive? + + /// Total item cost + public var net: Money? + + /// Unique Device Identifier + public var udi: [Reference]? + + /// Service Location + public var bodySite: CodeableConcept? + + /// Service Sub-location + public var subSite: [CodeableConcept]? + + /// Encounters related to this billed item + public var encounter: [Reference]? + + /// Additional items + public var detail: [ClaimItemDetail]? + + /// Designated initializer taking all required properties + public init(sequence: FHIRPrimitive) { + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + bodySite: CodeableConcept? = nil, + careTeamLinkId: [FHIRPrimitive]? = nil, + category: CodeableConcept? = nil, + detail: [ClaimItemDetail]? = nil, + diagnosisLinkId: [FHIRPrimitive]? = nil, + encounter: [Reference]? = nil, + `extension`: [Extension]? = nil, + factor: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + informationLinkId: [FHIRPrimitive]? = nil, + location: LocationX? = nil, + modifier: [CodeableConcept]? = nil, + modifierExtension: [Extension]? = nil, + net: Money? = nil, + procedureLinkId: [FHIRPrimitive]? = nil, + programCode: [CodeableConcept]? = nil, + quantity: Quantity? = nil, + revenue: CodeableConcept? = nil, + sequence: FHIRPrimitive, + service: CodeableConcept? = nil, + serviced: ServicedX? = nil, + subSite: [CodeableConcept]? = nil, + udi: [Reference]? = nil, + unitPrice: Money? = nil) + { + self.init(sequence: sequence) + self.bodySite = bodySite + self.careTeamLinkId = careTeamLinkId + self.category = category + self.detail = detail + self.diagnosisLinkId = diagnosisLinkId + self.encounter = encounter + self.`extension` = `extension` + self.factor = factor + self.id = id + self.informationLinkId = informationLinkId + self.location = location + self.modifier = modifier + self.modifierExtension = modifierExtension + self.net = net + self.procedureLinkId = procedureLinkId + self.programCode = programCode + self.quantity = quantity + self.revenue = revenue + self.service = service + self.serviced = serviced + self.subSite = subSite + self.udi = udi + self.unitPrice = unitPrice + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case bodySite + case careTeamLinkId; case _careTeamLinkId + case category + case detail + case diagnosisLinkId; case _diagnosisLinkId + case encounter + case factor; case _factor + case informationLinkId; case _informationLinkId + case locationAddress + case locationCodeableConcept + case locationReference + case modifier + case net + case procedureLinkId; case _procedureLinkId + case programCode + case quantity + case revenue + case sequence; case _sequence + case service + case servicedDate; case _servicedDate + case servicedPeriod + case subSite + case udi + case unitPrice + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.bodySite = try CodeableConcept(from: _container, forKeyIfPresent: .bodySite) + self.careTeamLinkId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .careTeamLinkId, auxiliaryKey: ._careTeamLinkId) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.detail = try [ClaimItemDetail](from: _container, forKeyIfPresent: .detail) + self.diagnosisLinkId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .diagnosisLinkId, auxiliaryKey: ._diagnosisLinkId) + self.encounter = try [Reference](from: _container, forKeyIfPresent: .encounter) + self.factor = try FHIRPrimitive(from: _container, forKeyIfPresent: .factor, auxiliaryKey: ._factor) + self.informationLinkId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .informationLinkId, auxiliaryKey: ._informationLinkId) + var _t_location: LocationX? = nil + if let locationCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .locationCodeableConcept) { + if _t_location != nil { + throw DecodingError.dataCorruptedError(forKey: .locationCodeableConcept, in: _container, debugDescription: "More than one value provided for \"location\"") + } + _t_location = .codeableConcept(locationCodeableConcept) + } + if let locationAddress = try Address(from: _container, forKeyIfPresent: .locationAddress) { + if _t_location != nil { + throw DecodingError.dataCorruptedError(forKey: .locationAddress, in: _container, debugDescription: "More than one value provided for \"location\"") + } + _t_location = .address(locationAddress) + } + if let locationReference = try Reference(from: _container, forKeyIfPresent: .locationReference) { + if _t_location != nil { + throw DecodingError.dataCorruptedError(forKey: .locationReference, in: _container, debugDescription: "More than one value provided for \"location\"") + } + _t_location = .reference(locationReference) + } + self.location = _t_location + self.modifier = try [CodeableConcept](from: _container, forKeyIfPresent: .modifier) + self.net = try Money(from: _container, forKeyIfPresent: .net) + self.procedureLinkId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .procedureLinkId, auxiliaryKey: ._procedureLinkId) + self.programCode = try [CodeableConcept](from: _container, forKeyIfPresent: .programCode) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.revenue = try CodeableConcept(from: _container, forKeyIfPresent: .revenue) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + self.service = try CodeableConcept(from: _container, forKeyIfPresent: .service) + var _t_serviced: ServicedX? = nil + if let servicedDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .servicedDate, auxiliaryKey: ._servicedDate) { + if _t_serviced != nil { + throw DecodingError.dataCorruptedError(forKey: .servicedDate, in: _container, debugDescription: "More than one value provided for \"serviced\"") + } + _t_serviced = .date(servicedDate) + } + if let servicedPeriod = try Period(from: _container, forKeyIfPresent: .servicedPeriod) { + if _t_serviced != nil { + throw DecodingError.dataCorruptedError(forKey: .servicedPeriod, in: _container, debugDescription: "More than one value provided for \"serviced\"") + } + _t_serviced = .period(servicedPeriod) + } + self.serviced = _t_serviced + self.subSite = try [CodeableConcept](from: _container, forKeyIfPresent: .subSite) + self.udi = try [Reference](from: _container, forKeyIfPresent: .udi) + self.unitPrice = try Money(from: _container, forKeyIfPresent: .unitPrice) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try bodySite?.encode(on: &_container, forKey: .bodySite) + try careTeamLinkId?.encode(on: &_container, forKey: .careTeamLinkId, auxiliaryKey: ._careTeamLinkId) + try category?.encode(on: &_container, forKey: .category) + try detail?.encode(on: &_container, forKey: .detail) + try diagnosisLinkId?.encode(on: &_container, forKey: .diagnosisLinkId, auxiliaryKey: ._diagnosisLinkId) + try encounter?.encode(on: &_container, forKey: .encounter) + try factor?.encode(on: &_container, forKey: .factor, auxiliaryKey: ._factor) + try informationLinkId?.encode(on: &_container, forKey: .informationLinkId, auxiliaryKey: ._informationLinkId) + if let _enum = location { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .locationCodeableConcept) + case .address(let _value): + try _value.encode(on: &_container, forKey: .locationAddress) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .locationReference) + } + } + try modifier?.encode(on: &_container, forKey: .modifier) + try net?.encode(on: &_container, forKey: .net) + try procedureLinkId?.encode(on: &_container, forKey: .procedureLinkId, auxiliaryKey: ._procedureLinkId) + try programCode?.encode(on: &_container, forKey: .programCode) + try quantity?.encode(on: &_container, forKey: .quantity) + try revenue?.encode(on: &_container, forKey: .revenue) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try service?.encode(on: &_container, forKey: .service) + if let _enum = serviced { + switch _enum { + case .date(let _value): + try _value.encode(on: &_container, forKey: .servicedDate, auxiliaryKey: ._servicedDate) + case .period(let _value): + try _value.encode(on: &_container, forKey: .servicedPeriod) + } + } + try subSite?.encode(on: &_container, forKey: .subSite) + try udi?.encode(on: &_container, forKey: .udi) + try unitPrice?.encode(on: &_container, forKey: .unitPrice) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return bodySite == _other.bodySite + && careTeamLinkId == _other.careTeamLinkId + && category == _other.category + && detail == _other.detail + && diagnosisLinkId == _other.diagnosisLinkId + && encounter == _other.encounter + && factor == _other.factor + && informationLinkId == _other.informationLinkId + && location == _other.location + && modifier == _other.modifier + && net == _other.net + && procedureLinkId == _other.procedureLinkId + && programCode == _other.programCode + && quantity == _other.quantity + && revenue == _other.revenue + && sequence == _other.sequence + && service == _other.service + && serviced == _other.serviced + && subSite == _other.subSite + && udi == _other.udi + && unitPrice == _other.unitPrice + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(bodySite) + hasher.combine(careTeamLinkId) + hasher.combine(category) + hasher.combine(detail) + hasher.combine(diagnosisLinkId) + hasher.combine(encounter) + hasher.combine(factor) + hasher.combine(informationLinkId) + hasher.combine(location) + hasher.combine(modifier) + hasher.combine(net) + hasher.combine(procedureLinkId) + hasher.combine(programCode) + hasher.combine(quantity) + hasher.combine(revenue) + hasher.combine(sequence) + hasher.combine(service) + hasher.combine(serviced) + hasher.combine(subSite) + hasher.combine(udi) + hasher.combine(unitPrice) + } +} + +/** + Additional items. + + Second tier of goods and services. + */ +open class ClaimItemDetail: BackboneElement { + + /// Service instance + public var sequence: FHIRPrimitive + + /// Revenue or cost center code + public var revenue: CodeableConcept? + + /// Type of service or product + public var category: CodeableConcept? + + /// Billing Code + public var service: CodeableConcept? + + /// Service/Product billing modifiers + public var modifier: [CodeableConcept]? + + /// Program specific reason for item inclusion + public var programCode: [CodeableConcept]? + + /// Count of Products or Services + public var quantity: Quantity? + + /// Fee, charge or cost per point + public var unitPrice: Money? + + /// Price scaling factor + public var factor: FHIRPrimitive? + + /// Total additional item cost + public var net: Money? + + /// Unique Device Identifier + public var udi: [Reference]? + + /// Additional items + public var subDetail: [ClaimItemDetailSubDetail]? + + /// Designated initializer taking all required properties + public init(sequence: FHIRPrimitive) { + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + category: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + factor: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + modifier: [CodeableConcept]? = nil, + modifierExtension: [Extension]? = nil, + net: Money? = nil, + programCode: [CodeableConcept]? = nil, + quantity: Quantity? = nil, + revenue: CodeableConcept? = nil, + sequence: FHIRPrimitive, + service: CodeableConcept? = nil, + subDetail: [ClaimItemDetailSubDetail]? = nil, + udi: [Reference]? = nil, + unitPrice: Money? = nil) + { + self.init(sequence: sequence) + self.category = category + self.`extension` = `extension` + self.factor = factor + self.id = id + self.modifier = modifier + self.modifierExtension = modifierExtension + self.net = net + self.programCode = programCode + self.quantity = quantity + self.revenue = revenue + self.service = service + self.subDetail = subDetail + self.udi = udi + self.unitPrice = unitPrice + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category + case factor; case _factor + case modifier + case net + case programCode + case quantity + case revenue + case sequence; case _sequence + case service + case subDetail + case udi + case unitPrice + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.factor = try FHIRPrimitive(from: _container, forKeyIfPresent: .factor, auxiliaryKey: ._factor) + self.modifier = try [CodeableConcept](from: _container, forKeyIfPresent: .modifier) + self.net = try Money(from: _container, forKeyIfPresent: .net) + self.programCode = try [CodeableConcept](from: _container, forKeyIfPresent: .programCode) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.revenue = try CodeableConcept(from: _container, forKeyIfPresent: .revenue) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + self.service = try CodeableConcept(from: _container, forKeyIfPresent: .service) + self.subDetail = try [ClaimItemDetailSubDetail](from: _container, forKeyIfPresent: .subDetail) + self.udi = try [Reference](from: _container, forKeyIfPresent: .udi) + self.unitPrice = try Money(from: _container, forKeyIfPresent: .unitPrice) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category?.encode(on: &_container, forKey: .category) + try factor?.encode(on: &_container, forKey: .factor, auxiliaryKey: ._factor) + try modifier?.encode(on: &_container, forKey: .modifier) + try net?.encode(on: &_container, forKey: .net) + try programCode?.encode(on: &_container, forKey: .programCode) + try quantity?.encode(on: &_container, forKey: .quantity) + try revenue?.encode(on: &_container, forKey: .revenue) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try service?.encode(on: &_container, forKey: .service) + try subDetail?.encode(on: &_container, forKey: .subDetail) + try udi?.encode(on: &_container, forKey: .udi) + try unitPrice?.encode(on: &_container, forKey: .unitPrice) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimItemDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && factor == _other.factor + && modifier == _other.modifier + && net == _other.net + && programCode == _other.programCode + && quantity == _other.quantity + && revenue == _other.revenue + && sequence == _other.sequence + && service == _other.service + && subDetail == _other.subDetail + && udi == _other.udi + && unitPrice == _other.unitPrice + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(factor) + hasher.combine(modifier) + hasher.combine(net) + hasher.combine(programCode) + hasher.combine(quantity) + hasher.combine(revenue) + hasher.combine(sequence) + hasher.combine(service) + hasher.combine(subDetail) + hasher.combine(udi) + hasher.combine(unitPrice) + } +} + +/** + Additional items. + + Third tier of goods and services. + */ +open class ClaimItemDetailSubDetail: BackboneElement { + + /// Service instance + public var sequence: FHIRPrimitive + + /// Revenue or cost center code + public var revenue: CodeableConcept? + + /// Type of service or product + public var category: CodeableConcept? + + /// Billing Code + public var service: CodeableConcept? + + /// Service/Product billing modifiers + public var modifier: [CodeableConcept]? + + /// Program specific reason for item inclusion + public var programCode: [CodeableConcept]? + + /// Count of Products or Services + public var quantity: Quantity? + + /// Fee, charge or cost per point + public var unitPrice: Money? + + /// Price scaling factor + public var factor: FHIRPrimitive? + + /// Net additional item cost + public var net: Money? + + /// Unique Device Identifier + public var udi: [Reference]? + + /// Designated initializer taking all required properties + public init(sequence: FHIRPrimitive) { + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + category: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + factor: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + modifier: [CodeableConcept]? = nil, + modifierExtension: [Extension]? = nil, + net: Money? = nil, + programCode: [CodeableConcept]? = nil, + quantity: Quantity? = nil, + revenue: CodeableConcept? = nil, + sequence: FHIRPrimitive, + service: CodeableConcept? = nil, + udi: [Reference]? = nil, + unitPrice: Money? = nil) + { + self.init(sequence: sequence) + self.category = category + self.`extension` = `extension` + self.factor = factor + self.id = id + self.modifier = modifier + self.modifierExtension = modifierExtension + self.net = net + self.programCode = programCode + self.quantity = quantity + self.revenue = revenue + self.service = service + self.udi = udi + self.unitPrice = unitPrice + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category + case factor; case _factor + case modifier + case net + case programCode + case quantity + case revenue + case sequence; case _sequence + case service + case udi + case unitPrice + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.factor = try FHIRPrimitive(from: _container, forKeyIfPresent: .factor, auxiliaryKey: ._factor) + self.modifier = try [CodeableConcept](from: _container, forKeyIfPresent: .modifier) + self.net = try Money(from: _container, forKeyIfPresent: .net) + self.programCode = try [CodeableConcept](from: _container, forKeyIfPresent: .programCode) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.revenue = try CodeableConcept(from: _container, forKeyIfPresent: .revenue) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + self.service = try CodeableConcept(from: _container, forKeyIfPresent: .service) + self.udi = try [Reference](from: _container, forKeyIfPresent: .udi) + self.unitPrice = try Money(from: _container, forKeyIfPresent: .unitPrice) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category?.encode(on: &_container, forKey: .category) + try factor?.encode(on: &_container, forKey: .factor, auxiliaryKey: ._factor) + try modifier?.encode(on: &_container, forKey: .modifier) + try net?.encode(on: &_container, forKey: .net) + try programCode?.encode(on: &_container, forKey: .programCode) + try quantity?.encode(on: &_container, forKey: .quantity) + try revenue?.encode(on: &_container, forKey: .revenue) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try service?.encode(on: &_container, forKey: .service) + try udi?.encode(on: &_container, forKey: .udi) + try unitPrice?.encode(on: &_container, forKey: .unitPrice) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimItemDetailSubDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && factor == _other.factor + && modifier == _other.modifier + && net == _other.net + && programCode == _other.programCode + && quantity == _other.quantity + && revenue == _other.revenue + && sequence == _other.sequence + && service == _other.service + && udi == _other.udi + && unitPrice == _other.unitPrice + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(factor) + hasher.combine(modifier) + hasher.combine(net) + hasher.combine(programCode) + hasher.combine(quantity) + hasher.combine(revenue) + hasher.combine(sequence) + hasher.combine(service) + hasher.combine(udi) + hasher.combine(unitPrice) + } +} + +/** + Party to be paid any benefits payable. + + The party to be reimbursed for the services. + */ +open class ClaimPayee: BackboneElement { + + /// Type of party: Subscriber, Provider, other + public var type: CodeableConcept + + /// organization | patient | practitioner | relatedperson + public var resourceType: Coding? + + /// Party to receive the payable + public var party: Reference? + + /// Designated initializer taking all required properties + public init(type: CodeableConcept) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + party: Reference? = nil, + resourceType: Coding? = nil, + type: CodeableConcept) + { + self.init(type: type) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.party = party + self.resourceType = resourceType + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case party + case resourceType + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.party = try Reference(from: _container, forKeyIfPresent: .party) + self.resourceType = try Coding(from: _container, forKeyIfPresent: .resourceType) + self.type = try CodeableConcept(from: _container, forKey: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try party?.encode(on: &_container, forKey: .party) + try resourceType?.encode(on: &_container, forKey: .resourceType) + try type.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimPayee else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return party == _other.party + && resourceType == _other.resourceType + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(party) + hasher.combine(resourceType) + hasher.combine(type) + } +} + +/** + Procedures performed. + + Ordered list of patient procedures performed to support the adjudication. + */ +open class ClaimProcedure: BackboneElement { + + /// All possible types for "procedure[x]" + public enum ProcedureX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Procedure sequence for reference + public var sequence: FHIRPrimitive + + /// When the procedure was performed + public var date: FHIRPrimitive? + + /// Patient's list of procedures performed + /// One of `procedure[x]` + public var procedure: ProcedureX + + /// Designated initializer taking all required properties + public init(procedure: ProcedureX, sequence: FHIRPrimitive) { + self.procedure = procedure + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + date: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + procedure: ProcedureX, + sequence: FHIRPrimitive) + { + self.init(procedure: procedure, sequence: sequence) + self.date = date + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case date; case _date + case procedureCodeableConcept + case procedureReference + case sequence; case _sequence + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.procedureCodeableConcept) || _container.contains(CodingKeys.procedureReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.procedureCodeableConcept, CodingKeys.procedureReference], debugDescription: "Must have at least one value for \"procedure\" but have none")) + } + + // Decode all our properties + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + var _t_procedure: ProcedureX? = nil + if let procedureCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .procedureCodeableConcept) { + if _t_procedure != nil { + throw DecodingError.dataCorruptedError(forKey: .procedureCodeableConcept, in: _container, debugDescription: "More than one value provided for \"procedure\"") + } + _t_procedure = .codeableConcept(procedureCodeableConcept) + } + if let procedureReference = try Reference(from: _container, forKeyIfPresent: .procedureReference) { + if _t_procedure != nil { + throw DecodingError.dataCorruptedError(forKey: .procedureReference, in: _container, debugDescription: "More than one value provided for \"procedure\"") + } + _t_procedure = .reference(procedureReference) + } + self.procedure = _t_procedure! + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + + switch procedure { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .procedureCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .procedureReference) + } + + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimProcedure else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return date == _other.date + && procedure == _other.procedure + && sequence == _other.sequence + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(date) + hasher.combine(procedure) + hasher.combine(sequence) + } +} + +/** + Related Claims which may be revelant to processing this claimn. + + Other claims which are related to this claim such as prior claim versions or for related services. + */ +open class ClaimRelated: BackboneElement { + + /// Reference to the related claim + public var claim: Reference? + + /// How the reference claim is related + public var relationship: CodeableConcept? + + /// Related file or case reference + public var reference: Identifier? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + claim: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reference: Identifier? = nil, + relationship: CodeableConcept? = nil) + { + self.init() + self.claim = claim + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reference = reference + self.relationship = relationship + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case claim + case reference + case relationship + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.claim = try Reference(from: _container, forKeyIfPresent: .claim) + self.reference = try Identifier(from: _container, forKeyIfPresent: .reference) + self.relationship = try CodeableConcept(from: _container, forKeyIfPresent: .relationship) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try claim?.encode(on: &_container, forKey: .claim) + try reference?.encode(on: &_container, forKey: .reference) + try relationship?.encode(on: &_container, forKey: .relationship) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimRelated else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return claim == _other.claim + && reference == _other.reference + && relationship == _other.relationship + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(claim) + hasher.combine(reference) + hasher.combine(relationship) + } +} diff --git a/Sources/ModelsSTU3/ClaimResponse.swift b/Sources/ModelsSTU3/ClaimResponse.swift new file mode 100644 index 0000000..a3cb2e7 --- /dev/null +++ b/Sources/ModelsSTU3/ClaimResponse.swift @@ -0,0 +1,1443 @@ +// +// ClaimResponse.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ClaimResponse) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Remittance resource. + + This resource provides the adjudication details from the processing of a Claim resource. + */ +open class ClaimResponse: DomainResource { + + override open class var resourceType: ResourceType { return .claimResponse } + + /// Response number + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// The subject of the Products and Services + public var patient: Reference? + + /// Creation date + public var created: FHIRPrimitive? + + /// Insurance issuing organization + public var insurer: Reference? + + /// Responsible practitioner + public var requestProvider: Reference? + + /// Responsible organization + public var requestOrganization: Reference? + + /// Id of resource triggering adjudication + public var request: Reference? + + /// complete | error | partial + public var outcome: CodeableConcept? + + /// Disposition Message + public var disposition: FHIRPrimitive? + + /// Party to be paid any benefits payable + public var payeeType: CodeableConcept? + + /// Line items + public var item: [ClaimResponseItem]? + + /// Insurer added line items + public var addItem: [ClaimResponseAddItem]? + + /// Processing errors + public var error: [ClaimResponseError]? + + /// Total Cost of service from the Claim + public var totalCost: Money? + + /// Unallocated deductible + public var unallocDeductable: Money? + + /// Total benefit payable for the Claim + public var totalBenefit: Money? + + /// Payment details, if paid + public var payment: ClaimResponsePayment? + + /// Funds reserved status + public var reserved: Coding? + + /// Printed Form Identifier + public var form: CodeableConcept? + + /// Processing notes + public var processNote: [ClaimResponseProcessNote]? + + /// Request for additional information + public var communicationRequest: [Reference]? + + /// Insurance or medical plan + public var insurance: [ClaimResponseInsurance]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + addItem: [ClaimResponseAddItem]? = nil, + communicationRequest: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + disposition: FHIRPrimitive? = nil, + error: [ClaimResponseError]? = nil, + `extension`: [Extension]? = nil, + form: CodeableConcept? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + insurance: [ClaimResponseInsurance]? = nil, + insurer: Reference? = nil, + item: [ClaimResponseItem]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + outcome: CodeableConcept? = nil, + patient: Reference? = nil, + payeeType: CodeableConcept? = nil, + payment: ClaimResponsePayment? = nil, + processNote: [ClaimResponseProcessNote]? = nil, + request: Reference? = nil, + requestOrganization: Reference? = nil, + requestProvider: Reference? = nil, + reserved: Coding? = nil, + status: FHIRPrimitive? = nil, + text: Narrative? = nil, + totalBenefit: Money? = nil, + totalCost: Money? = nil, + unallocDeductable: Money? = nil) + { + self.init() + self.addItem = addItem + self.communicationRequest = communicationRequest + self.contained = contained + self.created = created + self.disposition = disposition + self.error = error + self.`extension` = `extension` + self.form = form + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.insurance = insurance + self.insurer = insurer + self.item = item + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.outcome = outcome + self.patient = patient + self.payeeType = payeeType + self.payment = payment + self.processNote = processNote + self.request = request + self.requestOrganization = requestOrganization + self.requestProvider = requestProvider + self.reserved = reserved + self.status = status + self.text = text + self.totalBenefit = totalBenefit + self.totalCost = totalCost + self.unallocDeductable = unallocDeductable + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case addItem + case communicationRequest + case created; case _created + case disposition; case _disposition + case error + case form + case identifier + case insurance + case insurer + case item + case outcome + case patient + case payeeType + case payment + case processNote + case request + case requestOrganization + case requestProvider + case reserved + case status; case _status + case totalBenefit + case totalCost + case unallocDeductable + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.addItem = try [ClaimResponseAddItem](from: _container, forKeyIfPresent: .addItem) + self.communicationRequest = try [Reference](from: _container, forKeyIfPresent: .communicationRequest) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.disposition = try FHIRPrimitive(from: _container, forKeyIfPresent: .disposition, auxiliaryKey: ._disposition) + self.error = try [ClaimResponseError](from: _container, forKeyIfPresent: .error) + self.form = try CodeableConcept(from: _container, forKeyIfPresent: .form) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.insurance = try [ClaimResponseInsurance](from: _container, forKeyIfPresent: .insurance) + self.insurer = try Reference(from: _container, forKeyIfPresent: .insurer) + self.item = try [ClaimResponseItem](from: _container, forKeyIfPresent: .item) + self.outcome = try CodeableConcept(from: _container, forKeyIfPresent: .outcome) + self.patient = try Reference(from: _container, forKeyIfPresent: .patient) + self.payeeType = try CodeableConcept(from: _container, forKeyIfPresent: .payeeType) + self.payment = try ClaimResponsePayment(from: _container, forKeyIfPresent: .payment) + self.processNote = try [ClaimResponseProcessNote](from: _container, forKeyIfPresent: .processNote) + self.request = try Reference(from: _container, forKeyIfPresent: .request) + self.requestOrganization = try Reference(from: _container, forKeyIfPresent: .requestOrganization) + self.requestProvider = try Reference(from: _container, forKeyIfPresent: .requestProvider) + self.reserved = try Coding(from: _container, forKeyIfPresent: .reserved) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.totalBenefit = try Money(from: _container, forKeyIfPresent: .totalBenefit) + self.totalCost = try Money(from: _container, forKeyIfPresent: .totalCost) + self.unallocDeductable = try Money(from: _container, forKeyIfPresent: .unallocDeductable) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try addItem?.encode(on: &_container, forKey: .addItem) + try communicationRequest?.encode(on: &_container, forKey: .communicationRequest) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try disposition?.encode(on: &_container, forKey: .disposition, auxiliaryKey: ._disposition) + try error?.encode(on: &_container, forKey: .error) + try form?.encode(on: &_container, forKey: .form) + try identifier?.encode(on: &_container, forKey: .identifier) + try insurance?.encode(on: &_container, forKey: .insurance) + try insurer?.encode(on: &_container, forKey: .insurer) + try item?.encode(on: &_container, forKey: .item) + try outcome?.encode(on: &_container, forKey: .outcome) + try patient?.encode(on: &_container, forKey: .patient) + try payeeType?.encode(on: &_container, forKey: .payeeType) + try payment?.encode(on: &_container, forKey: .payment) + try processNote?.encode(on: &_container, forKey: .processNote) + try request?.encode(on: &_container, forKey: .request) + try requestOrganization?.encode(on: &_container, forKey: .requestOrganization) + try requestProvider?.encode(on: &_container, forKey: .requestProvider) + try reserved?.encode(on: &_container, forKey: .reserved) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try totalBenefit?.encode(on: &_container, forKey: .totalBenefit) + try totalCost?.encode(on: &_container, forKey: .totalCost) + try unallocDeductable?.encode(on: &_container, forKey: .unallocDeductable) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponse else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return addItem == _other.addItem + && communicationRequest == _other.communicationRequest + && created == _other.created + && disposition == _other.disposition + && error == _other.error + && form == _other.form + && identifier == _other.identifier + && insurance == _other.insurance + && insurer == _other.insurer + && item == _other.item + && outcome == _other.outcome + && patient == _other.patient + && payeeType == _other.payeeType + && payment == _other.payment + && processNote == _other.processNote + && request == _other.request + && requestOrganization == _other.requestOrganization + && requestProvider == _other.requestProvider + && reserved == _other.reserved + && status == _other.status + && totalBenefit == _other.totalBenefit + && totalCost == _other.totalCost + && unallocDeductable == _other.unallocDeductable + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(addItem) + hasher.combine(communicationRequest) + hasher.combine(created) + hasher.combine(disposition) + hasher.combine(error) + hasher.combine(form) + hasher.combine(identifier) + hasher.combine(insurance) + hasher.combine(insurer) + hasher.combine(item) + hasher.combine(outcome) + hasher.combine(patient) + hasher.combine(payeeType) + hasher.combine(payment) + hasher.combine(processNote) + hasher.combine(request) + hasher.combine(requestOrganization) + hasher.combine(requestProvider) + hasher.combine(reserved) + hasher.combine(status) + hasher.combine(totalBenefit) + hasher.combine(totalCost) + hasher.combine(unallocDeductable) + } +} + +/** + Insurer added line items. + + The first tier service adjudications for payor added services. + */ +open class ClaimResponseAddItem: BackboneElement { + + /// Service instances + public var sequenceLinkId: [FHIRPrimitive]? + + /// Revenue or cost center code + public var revenue: CodeableConcept? + + /// Type of service or product + public var category: CodeableConcept? + + /// Group, Service or Product + public var service: CodeableConcept? + + /// Service/Product billing modifiers + public var modifier: [CodeableConcept]? + + /// Professional fee or Product charge + public var fee: Money? + + /// List of note numbers which apply + public var noteNumber: [FHIRPrimitive]? + + /// Added items adjudication + public var adjudication: [ClaimResponseItemAdjudication]? + + /// Added items details + public var detail: [ClaimResponseAddItemDetail]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + adjudication: [ClaimResponseItemAdjudication]? = nil, + category: CodeableConcept? = nil, + detail: [ClaimResponseAddItemDetail]? = nil, + `extension`: [Extension]? = nil, + fee: Money? = nil, + id: FHIRPrimitive? = nil, + modifier: [CodeableConcept]? = nil, + modifierExtension: [Extension]? = nil, + noteNumber: [FHIRPrimitive]? = nil, + revenue: CodeableConcept? = nil, + sequenceLinkId: [FHIRPrimitive]? = nil, + service: CodeableConcept? = nil) + { + self.init() + self.adjudication = adjudication + self.category = category + self.detail = detail + self.`extension` = `extension` + self.fee = fee + self.id = id + self.modifier = modifier + self.modifierExtension = modifierExtension + self.noteNumber = noteNumber + self.revenue = revenue + self.sequenceLinkId = sequenceLinkId + self.service = service + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjudication + case category + case detail + case fee + case modifier + case noteNumber; case _noteNumber + case revenue + case sequenceLinkId; case _sequenceLinkId + case service + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjudication = try [ClaimResponseItemAdjudication](from: _container, forKeyIfPresent: .adjudication) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.detail = try [ClaimResponseAddItemDetail](from: _container, forKeyIfPresent: .detail) + self.fee = try Money(from: _container, forKeyIfPresent: .fee) + self.modifier = try [CodeableConcept](from: _container, forKeyIfPresent: .modifier) + self.noteNumber = try [FHIRPrimitive](from: _container, forKeyIfPresent: .noteNumber, auxiliaryKey: ._noteNumber) + self.revenue = try CodeableConcept(from: _container, forKeyIfPresent: .revenue) + self.sequenceLinkId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + self.service = try CodeableConcept(from: _container, forKeyIfPresent: .service) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjudication?.encode(on: &_container, forKey: .adjudication) + try category?.encode(on: &_container, forKey: .category) + try detail?.encode(on: &_container, forKey: .detail) + try fee?.encode(on: &_container, forKey: .fee) + try modifier?.encode(on: &_container, forKey: .modifier) + try noteNumber?.encode(on: &_container, forKey: .noteNumber, auxiliaryKey: ._noteNumber) + try revenue?.encode(on: &_container, forKey: .revenue) + try sequenceLinkId?.encode(on: &_container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + try service?.encode(on: &_container, forKey: .service) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponseAddItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjudication == _other.adjudication + && category == _other.category + && detail == _other.detail + && fee == _other.fee + && modifier == _other.modifier + && noteNumber == _other.noteNumber + && revenue == _other.revenue + && sequenceLinkId == _other.sequenceLinkId + && service == _other.service + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjudication) + hasher.combine(category) + hasher.combine(detail) + hasher.combine(fee) + hasher.combine(modifier) + hasher.combine(noteNumber) + hasher.combine(revenue) + hasher.combine(sequenceLinkId) + hasher.combine(service) + } +} + +/** + Added items details. + + The second tier service adjudications for payor added services. + */ +open class ClaimResponseAddItemDetail: BackboneElement { + + /// Revenue or cost center code + public var revenue: CodeableConcept? + + /// Type of service or product + public var category: CodeableConcept? + + /// Service or Product + public var service: CodeableConcept? + + /// Service/Product billing modifiers + public var modifier: [CodeableConcept]? + + /// Professional fee or Product charge + public var fee: Money? + + /// List of note numbers which apply + public var noteNumber: [FHIRPrimitive]? + + /// Added items detail adjudication + public var adjudication: [ClaimResponseItemAdjudication]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + adjudication: [ClaimResponseItemAdjudication]? = nil, + category: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + fee: Money? = nil, + id: FHIRPrimitive? = nil, + modifier: [CodeableConcept]? = nil, + modifierExtension: [Extension]? = nil, + noteNumber: [FHIRPrimitive]? = nil, + revenue: CodeableConcept? = nil, + service: CodeableConcept? = nil) + { + self.init() + self.adjudication = adjudication + self.category = category + self.`extension` = `extension` + self.fee = fee + self.id = id + self.modifier = modifier + self.modifierExtension = modifierExtension + self.noteNumber = noteNumber + self.revenue = revenue + self.service = service + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjudication + case category + case fee + case modifier + case noteNumber; case _noteNumber + case revenue + case service + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjudication = try [ClaimResponseItemAdjudication](from: _container, forKeyIfPresent: .adjudication) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.fee = try Money(from: _container, forKeyIfPresent: .fee) + self.modifier = try [CodeableConcept](from: _container, forKeyIfPresent: .modifier) + self.noteNumber = try [FHIRPrimitive](from: _container, forKeyIfPresent: .noteNumber, auxiliaryKey: ._noteNumber) + self.revenue = try CodeableConcept(from: _container, forKeyIfPresent: .revenue) + self.service = try CodeableConcept(from: _container, forKeyIfPresent: .service) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjudication?.encode(on: &_container, forKey: .adjudication) + try category?.encode(on: &_container, forKey: .category) + try fee?.encode(on: &_container, forKey: .fee) + try modifier?.encode(on: &_container, forKey: .modifier) + try noteNumber?.encode(on: &_container, forKey: .noteNumber, auxiliaryKey: ._noteNumber) + try revenue?.encode(on: &_container, forKey: .revenue) + try service?.encode(on: &_container, forKey: .service) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponseAddItemDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjudication == _other.adjudication + && category == _other.category + && fee == _other.fee + && modifier == _other.modifier + && noteNumber == _other.noteNumber + && revenue == _other.revenue + && service == _other.service + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjudication) + hasher.combine(category) + hasher.combine(fee) + hasher.combine(modifier) + hasher.combine(noteNumber) + hasher.combine(revenue) + hasher.combine(service) + } +} + +/** + Processing errors. + + Mutually exclusive with Services Provided (Item). + */ +open class ClaimResponseError: BackboneElement { + + /// Item sequence number + public var sequenceLinkId: FHIRPrimitive? + + /// Detail sequence number + public var detailSequenceLinkId: FHIRPrimitive? + + /// Subdetail sequence number + public var subdetailSequenceLinkId: FHIRPrimitive? + + /// Error code detailing processing issues + public var code: CodeableConcept + + /// Designated initializer taking all required properties + public init(code: CodeableConcept) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept, + detailSequenceLinkId: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + sequenceLinkId: FHIRPrimitive? = nil, + subdetailSequenceLinkId: FHIRPrimitive? = nil) + { + self.init(code: code) + self.detailSequenceLinkId = detailSequenceLinkId + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.sequenceLinkId = sequenceLinkId + self.subdetailSequenceLinkId = subdetailSequenceLinkId + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case detailSequenceLinkId; case _detailSequenceLinkId + case sequenceLinkId; case _sequenceLinkId + case subdetailSequenceLinkId; case _subdetailSequenceLinkId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKey: .code) + self.detailSequenceLinkId = try FHIRPrimitive(from: _container, forKeyIfPresent: .detailSequenceLinkId, auxiliaryKey: ._detailSequenceLinkId) + self.sequenceLinkId = try FHIRPrimitive(from: _container, forKeyIfPresent: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + self.subdetailSequenceLinkId = try FHIRPrimitive(from: _container, forKeyIfPresent: .subdetailSequenceLinkId, auxiliaryKey: ._subdetailSequenceLinkId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code) + try detailSequenceLinkId?.encode(on: &_container, forKey: .detailSequenceLinkId, auxiliaryKey: ._detailSequenceLinkId) + try sequenceLinkId?.encode(on: &_container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + try subdetailSequenceLinkId?.encode(on: &_container, forKey: .subdetailSequenceLinkId, auxiliaryKey: ._subdetailSequenceLinkId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponseError else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && detailSequenceLinkId == _other.detailSequenceLinkId + && sequenceLinkId == _other.sequenceLinkId + && subdetailSequenceLinkId == _other.subdetailSequenceLinkId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(detailSequenceLinkId) + hasher.combine(sequenceLinkId) + hasher.combine(subdetailSequenceLinkId) + } +} + +/** + Insurance or medical plan. + + Financial instrument by which payment information for health care. + */ +open class ClaimResponseInsurance: BackboneElement { + + /// Service instance identifier + public var sequence: FHIRPrimitive + + /// Is the focal Coverage + public var focal: FHIRPrimitive + + /// Insurance information + public var coverage: Reference + + /// Business agreement + public var businessArrangement: FHIRPrimitive? + + /// Pre-Authorization/Determination Reference + public var preAuthRef: [FHIRPrimitive]? + + /// Adjudication results + public var claimResponse: Reference? + + /// Designated initializer taking all required properties + public init(coverage: Reference, focal: FHIRPrimitive, sequence: FHIRPrimitive) { + self.coverage = coverage + self.focal = focal + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + businessArrangement: FHIRPrimitive? = nil, + claimResponse: Reference? = nil, + coverage: Reference, + `extension`: [Extension]? = nil, + focal: FHIRPrimitive, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + preAuthRef: [FHIRPrimitive]? = nil, + sequence: FHIRPrimitive) + { + self.init(coverage: coverage, focal: focal, sequence: sequence) + self.businessArrangement = businessArrangement + self.claimResponse = claimResponse + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.preAuthRef = preAuthRef + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case businessArrangement; case _businessArrangement + case claimResponse + case coverage + case focal; case _focal + case preAuthRef; case _preAuthRef + case sequence; case _sequence + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.businessArrangement = try FHIRPrimitive(from: _container, forKeyIfPresent: .businessArrangement, auxiliaryKey: ._businessArrangement) + self.claimResponse = try Reference(from: _container, forKeyIfPresent: .claimResponse) + self.coverage = try Reference(from: _container, forKey: .coverage) + self.focal = try FHIRPrimitive(from: _container, forKey: .focal, auxiliaryKey: ._focal) + self.preAuthRef = try [FHIRPrimitive](from: _container, forKeyIfPresent: .preAuthRef, auxiliaryKey: ._preAuthRef) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try businessArrangement?.encode(on: &_container, forKey: .businessArrangement, auxiliaryKey: ._businessArrangement) + try claimResponse?.encode(on: &_container, forKey: .claimResponse) + try coverage.encode(on: &_container, forKey: .coverage) + try focal.encode(on: &_container, forKey: .focal, auxiliaryKey: ._focal) + try preAuthRef?.encode(on: &_container, forKey: .preAuthRef, auxiliaryKey: ._preAuthRef) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponseInsurance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return businessArrangement == _other.businessArrangement + && claimResponse == _other.claimResponse + && coverage == _other.coverage + && focal == _other.focal + && preAuthRef == _other.preAuthRef + && sequence == _other.sequence + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(businessArrangement) + hasher.combine(claimResponse) + hasher.combine(coverage) + hasher.combine(focal) + hasher.combine(preAuthRef) + hasher.combine(sequence) + } +} + +/** + Line items. + + The first tier service adjudications for submitted services. + */ +open class ClaimResponseItem: BackboneElement { + + /// Service instance + public var sequenceLinkId: FHIRPrimitive + + /// List of note numbers which apply + public var noteNumber: [FHIRPrimitive]? + + /// Adjudication details + public var adjudication: [ClaimResponseItemAdjudication]? + + /// Detail line items + public var detail: [ClaimResponseItemDetail]? + + /// Designated initializer taking all required properties + public init(sequenceLinkId: FHIRPrimitive) { + self.sequenceLinkId = sequenceLinkId + super.init() + } + + /// Convenience initializer + public convenience init( + adjudication: [ClaimResponseItemAdjudication]? = nil, + detail: [ClaimResponseItemDetail]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + noteNumber: [FHIRPrimitive]? = nil, + sequenceLinkId: FHIRPrimitive) + { + self.init(sequenceLinkId: sequenceLinkId) + self.adjudication = adjudication + self.detail = detail + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.noteNumber = noteNumber + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjudication + case detail + case noteNumber; case _noteNumber + case sequenceLinkId; case _sequenceLinkId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjudication = try [ClaimResponseItemAdjudication](from: _container, forKeyIfPresent: .adjudication) + self.detail = try [ClaimResponseItemDetail](from: _container, forKeyIfPresent: .detail) + self.noteNumber = try [FHIRPrimitive](from: _container, forKeyIfPresent: .noteNumber, auxiliaryKey: ._noteNumber) + self.sequenceLinkId = try FHIRPrimitive(from: _container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjudication?.encode(on: &_container, forKey: .adjudication) + try detail?.encode(on: &_container, forKey: .detail) + try noteNumber?.encode(on: &_container, forKey: .noteNumber, auxiliaryKey: ._noteNumber) + try sequenceLinkId.encode(on: &_container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponseItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjudication == _other.adjudication + && detail == _other.detail + && noteNumber == _other.noteNumber + && sequenceLinkId == _other.sequenceLinkId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjudication) + hasher.combine(detail) + hasher.combine(noteNumber) + hasher.combine(sequenceLinkId) + } +} + +/** + Adjudication details. + + The adjudication results. + */ +open class ClaimResponseItemAdjudication: BackboneElement { + + /// Adjudication category such as co-pay, eligible, benefit, etc. + public var category: CodeableConcept + + /// Explanation of Adjudication outcome + public var reason: CodeableConcept? + + /// Monetary amount + public var amount: Money? + + /// Non-monetary value + public var value: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(category: CodeableConcept) { + self.category = category + super.init() + } + + /// Convenience initializer + public convenience init( + amount: Money? = nil, + category: CodeableConcept, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reason: CodeableConcept? = nil, + value: FHIRPrimitive? = nil) + { + self.init(category: category) + self.amount = amount + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reason = reason + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case amount + case category + case reason + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.amount = try Money(from: _container, forKeyIfPresent: .amount) + self.category = try CodeableConcept(from: _container, forKey: .category) + self.reason = try CodeableConcept(from: _container, forKeyIfPresent: .reason) + self.value = try FHIRPrimitive(from: _container, forKeyIfPresent: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try amount?.encode(on: &_container, forKey: .amount) + try category.encode(on: &_container, forKey: .category) + try reason?.encode(on: &_container, forKey: .reason) + try value?.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponseItemAdjudication else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return amount == _other.amount + && category == _other.category + && reason == _other.reason + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(amount) + hasher.combine(category) + hasher.combine(reason) + hasher.combine(value) + } +} + +/** + Detail line items. + + The second tier service adjudications for submitted services. + */ +open class ClaimResponseItemDetail: BackboneElement { + + /// Service instance + public var sequenceLinkId: FHIRPrimitive + + /// List of note numbers which apply + public var noteNumber: [FHIRPrimitive]? + + /// Detail level adjudication details + public var adjudication: [ClaimResponseItemAdjudication]? + + /// Subdetail line items + public var subDetail: [ClaimResponseItemDetailSubDetail]? + + /// Designated initializer taking all required properties + public init(sequenceLinkId: FHIRPrimitive) { + self.sequenceLinkId = sequenceLinkId + super.init() + } + + /// Convenience initializer + public convenience init( + adjudication: [ClaimResponseItemAdjudication]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + noteNumber: [FHIRPrimitive]? = nil, + sequenceLinkId: FHIRPrimitive, + subDetail: [ClaimResponseItemDetailSubDetail]? = nil) + { + self.init(sequenceLinkId: sequenceLinkId) + self.adjudication = adjudication + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.noteNumber = noteNumber + self.subDetail = subDetail + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjudication + case noteNumber; case _noteNumber + case sequenceLinkId; case _sequenceLinkId + case subDetail + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjudication = try [ClaimResponseItemAdjudication](from: _container, forKeyIfPresent: .adjudication) + self.noteNumber = try [FHIRPrimitive](from: _container, forKeyIfPresent: .noteNumber, auxiliaryKey: ._noteNumber) + self.sequenceLinkId = try FHIRPrimitive(from: _container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + self.subDetail = try [ClaimResponseItemDetailSubDetail](from: _container, forKeyIfPresent: .subDetail) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjudication?.encode(on: &_container, forKey: .adjudication) + try noteNumber?.encode(on: &_container, forKey: .noteNumber, auxiliaryKey: ._noteNumber) + try sequenceLinkId.encode(on: &_container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + try subDetail?.encode(on: &_container, forKey: .subDetail) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponseItemDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjudication == _other.adjudication + && noteNumber == _other.noteNumber + && sequenceLinkId == _other.sequenceLinkId + && subDetail == _other.subDetail + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjudication) + hasher.combine(noteNumber) + hasher.combine(sequenceLinkId) + hasher.combine(subDetail) + } +} + +/** + Subdetail line items. + + The third tier service adjudications for submitted services. + */ +open class ClaimResponseItemDetailSubDetail: BackboneElement { + + /// Service instance + public var sequenceLinkId: FHIRPrimitive + + /// List of note numbers which apply + public var noteNumber: [FHIRPrimitive]? + + /// Subdetail level adjudication details + public var adjudication: [ClaimResponseItemAdjudication]? + + /// Designated initializer taking all required properties + public init(sequenceLinkId: FHIRPrimitive) { + self.sequenceLinkId = sequenceLinkId + super.init() + } + + /// Convenience initializer + public convenience init( + adjudication: [ClaimResponseItemAdjudication]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + noteNumber: [FHIRPrimitive]? = nil, + sequenceLinkId: FHIRPrimitive) + { + self.init(sequenceLinkId: sequenceLinkId) + self.adjudication = adjudication + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.noteNumber = noteNumber + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjudication + case noteNumber; case _noteNumber + case sequenceLinkId; case _sequenceLinkId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjudication = try [ClaimResponseItemAdjudication](from: _container, forKeyIfPresent: .adjudication) + self.noteNumber = try [FHIRPrimitive](from: _container, forKeyIfPresent: .noteNumber, auxiliaryKey: ._noteNumber) + self.sequenceLinkId = try FHIRPrimitive(from: _container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjudication?.encode(on: &_container, forKey: .adjudication) + try noteNumber?.encode(on: &_container, forKey: .noteNumber, auxiliaryKey: ._noteNumber) + try sequenceLinkId.encode(on: &_container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponseItemDetailSubDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjudication == _other.adjudication + && noteNumber == _other.noteNumber + && sequenceLinkId == _other.sequenceLinkId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjudication) + hasher.combine(noteNumber) + hasher.combine(sequenceLinkId) + } +} + +/** + Payment details, if paid. + + Payment details for the claim if the claim has been paid. + */ +open class ClaimResponsePayment: BackboneElement { + + /// Partial or Complete + public var type: CodeableConcept? + + /// Payment adjustment for non-Claim issues + public var adjustment: Money? + + /// Explanation for the non-claim adjustment + public var adjustmentReason: CodeableConcept? + + /// Expected data of Payment + public var date: FHIRPrimitive? + + /// Payable amount after adjustment + public var amount: Money? + + /// Identifier of the payment instrument + public var identifier: Identifier? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + adjustment: Money? = nil, + adjustmentReason: CodeableConcept? = nil, + amount: Money? = nil, + date: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.adjustment = adjustment + self.adjustmentReason = adjustmentReason + self.amount = amount + self.date = date + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjustment + case adjustmentReason + case amount + case date; case _date + case identifier + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjustment = try Money(from: _container, forKeyIfPresent: .adjustment) + self.adjustmentReason = try CodeableConcept(from: _container, forKeyIfPresent: .adjustmentReason) + self.amount = try Money(from: _container, forKeyIfPresent: .amount) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjustment?.encode(on: &_container, forKey: .adjustment) + try adjustmentReason?.encode(on: &_container, forKey: .adjustmentReason) + try amount?.encode(on: &_container, forKey: .amount) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try identifier?.encode(on: &_container, forKey: .identifier) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponsePayment else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjustment == _other.adjustment + && adjustmentReason == _other.adjustmentReason + && amount == _other.amount + && date == _other.date + && identifier == _other.identifier + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjustment) + hasher.combine(adjustmentReason) + hasher.combine(amount) + hasher.combine(date) + hasher.combine(identifier) + hasher.combine(type) + } +} + +/** + Processing notes. + + Note text. + */ +open class ClaimResponseProcessNote: BackboneElement { + + /// Sequence Number for this note + public var number: FHIRPrimitive? + + /// display | print | printoper + public var type: CodeableConcept? + + /// Note explanatory text + public var text: FHIRPrimitive? + + /// Language if different from the resource + public var language: CodeableConcept? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + language: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil, + number: FHIRPrimitive? = nil, + text: FHIRPrimitive? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.language = language + self.modifierExtension = modifierExtension + self.number = number + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case language + case number; case _number + case text; case _text + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.language = try CodeableConcept(from: _container, forKeyIfPresent: .language) + self.number = try FHIRPrimitive(from: _container, forKeyIfPresent: .number, auxiliaryKey: ._number) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try language?.encode(on: &_container, forKey: .language) + try number?.encode(on: &_container, forKey: .number, auxiliaryKey: ._number) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClaimResponseProcessNote else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return language == _other.language + && number == _other.number + && text == _other.text + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(language) + hasher.combine(number) + hasher.combine(text) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/ClinicalImpression.swift b/Sources/ModelsSTU3/ClinicalImpression.swift new file mode 100644 index 0000000..a880d4c --- /dev/null +++ b/Sources/ModelsSTU3/ClinicalImpression.swift @@ -0,0 +1,512 @@ +// +// ClinicalImpression.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A clinical assessment performed when planning treatments and management strategies for a patient. + + A record of a clinical assessment performed to determine what problem(s) may affect the patient and before planning the + treatments or management strategies that are best to manage a patient's condition. Assessments are often 1:1 with a + clinical consultation / encounter, but this varies greatly depending on the clinical workflow. This resource is called + "ClinicalImpression" rather than "ClinicalAssessment" to avoid confusion with the recording of assessment tools such as + Apgar score. + */ +open class ClinicalImpression: DomainResource { + + override open class var resourceType: ResourceType { return .clinicalImpression } + + /// All possible types for "effective[x]" + public enum EffectiveX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// Business identifier + public var identifier: [Identifier]? + + /// Identifies the workflow status of the assessment. + public var status: FHIRPrimitive + + /// Kind of assessment performed + public var code: CodeableConcept? + + /// Why/how the assessment was performed + public var description_fhir: FHIRPrimitive? + + /// Patient or group assessed + public var subject: Reference + + /// Encounter or Episode created from + public var context: Reference? + + /// Time of assessment + /// One of `effective[x]` + public var effective: EffectiveX? + + /// When the assessment was documented + public var date: FHIRPrimitive? + + /// The clinician performing the assessment + public var assessor: Reference? + + /// Reference to last assessment + public var previous: Reference? + + /// Relevant impressions of patient state + public var problem: [Reference]? + + /// One or more sets of investigations (signs, symptions, etc.) + public var investigation: [ClinicalImpressionInvestigation]? + + /// Clinical Protocol followed + public var `protocol`: [FHIRPrimitive]? + + /// Summary of the assessment + public var summary: FHIRPrimitive? + + /// Possible or likely findings and diagnoses + public var finding: [ClinicalImpressionFinding]? + + /// Estimate of likely outcome + public var prognosisCodeableConcept: [CodeableConcept]? + + /// RiskAssessment expressing likely outcome + public var prognosisReference: [Reference]? + + /// Action taken as part of assessment procedure + public var action: [Reference]? + + /// Comments made about the ClinicalImpression + public var note: [Annotation]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive, subject: Reference) { + self.status = status + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + action: [Reference]? = nil, + assessor: Reference? = nil, + code: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + effective: EffectiveX? = nil, + `extension`: [Extension]? = nil, + finding: [ClinicalImpressionFinding]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + investigation: [ClinicalImpressionInvestigation]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + previous: Reference? = nil, + problem: [Reference]? = nil, + prognosisCodeableConcept: [CodeableConcept]? = nil, + prognosisReference: [Reference]? = nil, + `protocol`: [FHIRPrimitive]? = nil, + status: FHIRPrimitive, + subject: Reference, + summary: FHIRPrimitive? = nil, + text: Narrative? = nil) + { + self.init(status: status, subject: subject) + self.action = action + self.assessor = assessor + self.code = code + self.contained = contained + self.context = context + self.date = date + self.description_fhir = description_fhir + self.effective = effective + self.`extension` = `extension` + self.finding = finding + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.investigation = investigation + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.previous = previous + self.problem = problem + self.prognosisCodeableConcept = prognosisCodeableConcept + self.prognosisReference = prognosisReference + self.`protocol` = `protocol` + self.summary = summary + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case assessor + case code + case context + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case effectiveDateTime; case _effectiveDateTime + case effectivePeriod + case finding + case identifier + case investigation + case note + case previous + case problem + case prognosisCodeableConcept + case prognosisReference + case `protocol` = "protocol"; case _protocol = "_protocol" + case status; case _status + case subject + case summary; case _summary + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [Reference](from: _container, forKeyIfPresent: .action) + self.assessor = try Reference(from: _container, forKeyIfPresent: .assessor) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + var _t_effective: EffectiveX? = nil + if let effectiveDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .effectiveDateTime, auxiliaryKey: ._effectiveDateTime) { + if _t_effective != nil { + throw DecodingError.dataCorruptedError(forKey: .effectiveDateTime, in: _container, debugDescription: "More than one value provided for \"effective\"") + } + _t_effective = .dateTime(effectiveDateTime) + } + if let effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) { + if _t_effective != nil { + throw DecodingError.dataCorruptedError(forKey: .effectivePeriod, in: _container, debugDescription: "More than one value provided for \"effective\"") + } + _t_effective = .period(effectivePeriod) + } + self.effective = _t_effective + self.finding = try [ClinicalImpressionFinding](from: _container, forKeyIfPresent: .finding) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.investigation = try [ClinicalImpressionInvestigation](from: _container, forKeyIfPresent: .investigation) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.previous = try Reference(from: _container, forKeyIfPresent: .previous) + self.problem = try [Reference](from: _container, forKeyIfPresent: .problem) + self.prognosisCodeableConcept = try [CodeableConcept](from: _container, forKeyIfPresent: .prognosisCodeableConcept) + self.prognosisReference = try [Reference](from: _container, forKeyIfPresent: .prognosisReference) + self.`protocol` = try [FHIRPrimitive](from: _container, forKeyIfPresent: .`protocol`, auxiliaryKey: ._protocol) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.summary = try FHIRPrimitive(from: _container, forKeyIfPresent: .summary, auxiliaryKey: ._summary) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action) + try assessor?.encode(on: &_container, forKey: .assessor) + try code?.encode(on: &_container, forKey: .code) + try context?.encode(on: &_container, forKey: .context) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + if let _enum = effective { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .effectiveDateTime, auxiliaryKey: ._effectiveDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .effectivePeriod) + } + } + try finding?.encode(on: &_container, forKey: .finding) + try identifier?.encode(on: &_container, forKey: .identifier) + try investigation?.encode(on: &_container, forKey: .investigation) + try note?.encode(on: &_container, forKey: .note) + try previous?.encode(on: &_container, forKey: .previous) + try problem?.encode(on: &_container, forKey: .problem) + try prognosisCodeableConcept?.encode(on: &_container, forKey: .prognosisCodeableConcept) + try prognosisReference?.encode(on: &_container, forKey: .prognosisReference) + try `protocol`?.encode(on: &_container, forKey: .`protocol`, auxiliaryKey: ._protocol) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try summary?.encode(on: &_container, forKey: .summary, auxiliaryKey: ._summary) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClinicalImpression else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && assessor == _other.assessor + && code == _other.code + && context == _other.context + && date == _other.date + && description_fhir == _other.description_fhir + && effective == _other.effective + && finding == _other.finding + && identifier == _other.identifier + && investigation == _other.investigation + && note == _other.note + && previous == _other.previous + && problem == _other.problem + && prognosisCodeableConcept == _other.prognosisCodeableConcept + && prognosisReference == _other.prognosisReference + && `protocol` == _other.`protocol` + && status == _other.status + && subject == _other.subject + && summary == _other.summary + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(assessor) + hasher.combine(code) + hasher.combine(context) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(effective) + hasher.combine(finding) + hasher.combine(identifier) + hasher.combine(investigation) + hasher.combine(note) + hasher.combine(previous) + hasher.combine(problem) + hasher.combine(prognosisCodeableConcept) + hasher.combine(prognosisReference) + hasher.combine(`protocol`) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(summary) + } +} + +/** + Possible or likely findings and diagnoses. + + Specific findings or diagnoses that was considered likely or relevant to ongoing treatment. + */ +open class ClinicalImpressionFinding: BackboneElement { + + /// All possible types for "item[x]" + public enum ItemX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// What was found + /// One of `item[x]` + public var item: ItemX + + /// Which investigations support finding + public var basis: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(item: ItemX) { + self.item = item + super.init() + } + + /// Convenience initializer + public convenience init( + basis: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + item: ItemX, + modifierExtension: [Extension]? = nil) + { + self.init(item: item) + self.basis = basis + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case basis; case _basis + case itemCodeableConcept + case itemReference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.itemCodeableConcept) || _container.contains(CodingKeys.itemReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.itemCodeableConcept, CodingKeys.itemReference], debugDescription: "Must have at least one value for \"item\" but have none")) + } + + // Decode all our properties + self.basis = try FHIRPrimitive(from: _container, forKeyIfPresent: .basis, auxiliaryKey: ._basis) + var _t_item: ItemX? = nil + if let itemCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .itemCodeableConcept) { + if _t_item != nil { + throw DecodingError.dataCorruptedError(forKey: .itemCodeableConcept, in: _container, debugDescription: "More than one value provided for \"item\"") + } + _t_item = .codeableConcept(itemCodeableConcept) + } + if let itemReference = try Reference(from: _container, forKeyIfPresent: .itemReference) { + if _t_item != nil { + throw DecodingError.dataCorruptedError(forKey: .itemReference, in: _container, debugDescription: "More than one value provided for \"item\"") + } + _t_item = .reference(itemReference) + } + self.item = _t_item! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try basis?.encode(on: &_container, forKey: .basis, auxiliaryKey: ._basis) + + switch item { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .itemCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .itemReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClinicalImpressionFinding else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return basis == _other.basis + && item == _other.item + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(basis) + hasher.combine(item) + } +} + +/** + One or more sets of investigations (signs, symptions, etc.). + + One or more sets of investigations (signs, symptions, etc.). The actual grouping of investigations vary greatly + depending on the type and context of the assessment. These investigations may include data generated during the + assessment process, or data previously generated and recorded that is pertinent to the outcomes. + */ +open class ClinicalImpressionInvestigation: BackboneElement { + + /// A name/code for the set + public var code: CodeableConcept + + /// Record of a specific investigation + public var item: [Reference]? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + item: [Reference]? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(code: code) + self.`extension` = `extension` + self.id = id + self.item = item + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case item + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKey: .code) + self.item = try [Reference](from: _container, forKeyIfPresent: .item) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code) + try item?.encode(on: &_container, forKey: .item) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ClinicalImpressionInvestigation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && item == _other.item + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(item) + } +} diff --git a/Sources/ModelsSTU3/CodeSystem.swift b/Sources/ModelsSTU3/CodeSystem.swift new file mode 100644 index 0000000..c692560 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystem.swift @@ -0,0 +1,915 @@ +// +// CodeSystem.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CodeSystem) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A set of codes drawn from one or more code systems. + + A code system resource specifies a set of codes drawn from one or more code systems. + */ +open class CodeSystem: DomainResource { + + override open class var resourceType: ResourceType { return .codeSystem } + + /// Logical URI to reference this code system (globally unique) (Coding.system) + public var url: FHIRPrimitive? + + /// Additional identifier for the code system + public var identifier: Identifier? + + /// Business version of the code system (Coding.version) + public var version: FHIRPrimitive? + + /// Name for this code system (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this code system (human friendly) + public var title: FHIRPrimitive? + + /// The status of this code system. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the code system + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for code system (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Why this code system is defined + public var purpose: FHIRPrimitive? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// If code comparison is case sensitive + public var caseSensitive: FHIRPrimitive? + + /// Canonical URL for value set with entire code system + public var valueSet: FHIRPrimitive? + + /// The meaning of the hierarchy of concepts. + public var hierarchyMeaning: FHIRPrimitive? + + /// If code system defines a post-composition grammar + public var compositional: FHIRPrimitive? + + /// If definitions are not stable + public var versionNeeded: FHIRPrimitive? + + /// How much of the content of the code system - the concepts and codes it defines - are represented in this + /// resource. + public var content: FHIRPrimitive + + /// Total concepts in the code system + public var count: FHIRPrimitive? + + /// Filter that can be used in a value set + public var filter: [CodeSystemFilter]? + + /// Additional information supplied about each concept + public var property: [CodeSystemProperty]? + + /// Concepts in the code system + public var concept: [CodeSystemConcept]? + + /// Designated initializer taking all required properties + public init(content: FHIRPrimitive, status: FHIRPrimitive) { + self.content = content + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + caseSensitive: FHIRPrimitive? = nil, + compositional: FHIRPrimitive? = nil, + concept: [CodeSystemConcept]? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + content: FHIRPrimitive, + copyright: FHIRPrimitive? = nil, + count: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + filter: [CodeSystemFilter]? = nil, + hierarchyMeaning: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + property: [CodeSystemProperty]? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + valueSet: FHIRPrimitive? = nil, + version: FHIRPrimitive? = nil, + versionNeeded: FHIRPrimitive? = nil) + { + self.init(content: content, status: status) + self.caseSensitive = caseSensitive + self.compositional = compositional + self.concept = concept + self.contact = contact + self.contained = contained + self.copyright = copyright + self.count = count + self.date = date + self.description_fhir = description_fhir + self.experimental = experimental + self.`extension` = `extension` + self.filter = filter + self.hierarchyMeaning = hierarchyMeaning + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.property = property + self.publisher = publisher + self.purpose = purpose + self.text = text + self.title = title + self.url = url + self.useContext = useContext + self.valueSet = valueSet + self.version = version + self.versionNeeded = versionNeeded + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case caseSensitive; case _caseSensitive + case compositional; case _compositional + case concept + case contact + case content; case _content + case copyright; case _copyright + case count; case _count + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case experimental; case _experimental + case filter + case hierarchyMeaning; case _hierarchyMeaning + case identifier + case jurisdiction + case name; case _name + case property + case publisher; case _publisher + case purpose; case _purpose + case status; case _status + case title; case _title + case url; case _url + case useContext + case valueSet; case _valueSet + case version; case _version + case versionNeeded; case _versionNeeded + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.caseSensitive = try FHIRPrimitive(from: _container, forKeyIfPresent: .caseSensitive, auxiliaryKey: ._caseSensitive) + self.compositional = try FHIRPrimitive(from: _container, forKeyIfPresent: .compositional, auxiliaryKey: ._compositional) + self.concept = try [CodeSystemConcept](from: _container, forKeyIfPresent: .concept) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.content = try FHIRPrimitive(from: _container, forKey: .content, auxiliaryKey: ._content) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.count = try FHIRPrimitive(from: _container, forKeyIfPresent: .count, auxiliaryKey: ._count) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.filter = try [CodeSystemFilter](from: _container, forKeyIfPresent: .filter) + self.hierarchyMeaning = try FHIRPrimitive(from: _container, forKeyIfPresent: .hierarchyMeaning, auxiliaryKey: ._hierarchyMeaning) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.property = try [CodeSystemProperty](from: _container, forKeyIfPresent: .property) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.valueSet = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueSet, auxiliaryKey: ._valueSet) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + self.versionNeeded = try FHIRPrimitive(from: _container, forKeyIfPresent: .versionNeeded, auxiliaryKey: ._versionNeeded) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try caseSensitive?.encode(on: &_container, forKey: .caseSensitive, auxiliaryKey: ._caseSensitive) + try compositional?.encode(on: &_container, forKey: .compositional, auxiliaryKey: ._compositional) + try concept?.encode(on: &_container, forKey: .concept) + try contact?.encode(on: &_container, forKey: .contact) + try content.encode(on: &_container, forKey: .content, auxiliaryKey: ._content) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try count?.encode(on: &_container, forKey: .count, auxiliaryKey: ._count) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try filter?.encode(on: &_container, forKey: .filter) + try hierarchyMeaning?.encode(on: &_container, forKey: .hierarchyMeaning, auxiliaryKey: ._hierarchyMeaning) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try property?.encode(on: &_container, forKey: .property) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try valueSet?.encode(on: &_container, forKey: .valueSet, auxiliaryKey: ._valueSet) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try versionNeeded?.encode(on: &_container, forKey: .versionNeeded, auxiliaryKey: ._versionNeeded) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CodeSystem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return caseSensitive == _other.caseSensitive + && compositional == _other.compositional + && concept == _other.concept + && contact == _other.contact + && content == _other.content + && copyright == _other.copyright + && count == _other.count + && date == _other.date + && description_fhir == _other.description_fhir + && experimental == _other.experimental + && filter == _other.filter + && hierarchyMeaning == _other.hierarchyMeaning + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && name == _other.name + && property == _other.property + && publisher == _other.publisher + && purpose == _other.purpose + && status == _other.status + && title == _other.title + && url == _other.url + && useContext == _other.useContext + && valueSet == _other.valueSet + && version == _other.version + && versionNeeded == _other.versionNeeded + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(caseSensitive) + hasher.combine(compositional) + hasher.combine(concept) + hasher.combine(contact) + hasher.combine(content) + hasher.combine(copyright) + hasher.combine(count) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(experimental) + hasher.combine(filter) + hasher.combine(hierarchyMeaning) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(name) + hasher.combine(property) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(status) + hasher.combine(title) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(valueSet) + hasher.combine(version) + hasher.combine(versionNeeded) + } +} + +/** + Concepts in the code system. + + Concepts that are in the code system. The concept definitions are inherently hierarchical, but the definitions must be + consulted to determine what the meaning of the hierarchical relationships are. + */ +open class CodeSystemConcept: BackboneElement { + + /// Code that identifies concept + public var code: FHIRPrimitive + + /// Text to display to the user + public var display: FHIRPrimitive? + + /// Formal definition + public var definition: FHIRPrimitive? + + /// Additional representations for the concept + public var designation: [CodeSystemConceptDesignation]? + + /// Property value for the concept + public var property: [CodeSystemConceptProperty]? + + /// Child Concepts (is-a/contains/categorizes) + public var concept: [CodeSystemConcept]? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + concept: [CodeSystemConcept]? = nil, + definition: FHIRPrimitive? = nil, + designation: [CodeSystemConceptDesignation]? = nil, + display: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + property: [CodeSystemConceptProperty]? = nil) + { + self.init(code: code) + self.concept = concept + self.definition = definition + self.designation = designation + self.display = display + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.property = property + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case concept + case definition; case _definition + case designation + case display; case _display + case property + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.concept = try [CodeSystemConcept](from: _container, forKeyIfPresent: .concept) + self.definition = try FHIRPrimitive(from: _container, forKeyIfPresent: .definition, auxiliaryKey: ._definition) + self.designation = try [CodeSystemConceptDesignation](from: _container, forKeyIfPresent: .designation) + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + self.property = try [CodeSystemConceptProperty](from: _container, forKeyIfPresent: .property) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try concept?.encode(on: &_container, forKey: .concept) + try definition?.encode(on: &_container, forKey: .definition, auxiliaryKey: ._definition) + try designation?.encode(on: &_container, forKey: .designation) + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try property?.encode(on: &_container, forKey: .property) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CodeSystemConcept else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && concept == _other.concept + && definition == _other.definition + && designation == _other.designation + && display == _other.display + && property == _other.property + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(concept) + hasher.combine(definition) + hasher.combine(designation) + hasher.combine(display) + hasher.combine(property) + } +} + +/** + Additional representations for the concept. + + Additional representations for the concept - other languages, aliases, specialized purposes, used for particular + purposes, etc. + */ +open class CodeSystemConceptDesignation: BackboneElement { + + /// Human language of the designation + public var language: FHIRPrimitive? + + /// Details how this designation would be used + public var use: Coding? + + /// The text value for this designation + public var value: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(value: FHIRPrimitive) { + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + use: Coding? = nil, + value: FHIRPrimitive) + { + self.init(value: value) + self.`extension` = `extension` + self.id = id + self.language = language + self.modifierExtension = modifierExtension + self.use = use + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case language; case _language + case use + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + self.use = try Coding(from: _container, forKeyIfPresent: .use) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try use?.encode(on: &_container, forKey: .use) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CodeSystemConceptDesignation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return language == _other.language + && use == _other.use + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(language) + hasher.combine(use) + hasher.combine(value) + } +} + +/** + Property value for the concept. + + A property value for this concept. + */ +open class CodeSystemConceptProperty: BackboneElement { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case coding(Coding) + case dateTime(FHIRPrimitive) + case integer(FHIRPrimitive) + case string(FHIRPrimitive) + } + + /// Reference to CodeSystem.property.code + public var code: FHIRPrimitive + + /// Value of the property for this concept + /// One of `value[x]` + public var value: ValueX + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, value: ValueX) { + self.code = code + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + value: ValueX) + { + self.init(code: code, value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case valueBoolean; case _valueBoolean + case valueCode; case _valueCode + case valueCoding + case valueDateTime; case _valueDateTime + case valueInteger; case _valueInteger + case valueString; case _valueString + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.valueBoolean) || _container.contains(CodingKeys.valueCode) || _container.contains(CodingKeys.valueCoding) || _container.contains(CodingKeys.valueDateTime) || _container.contains(CodingKeys.valueInteger) || _container.contains(CodingKeys.valueString) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.valueBoolean, CodingKeys.valueCode, CodingKeys.valueCoding, CodingKeys.valueDateTime, CodingKeys.valueInteger, CodingKeys.valueString], debugDescription: "Must have at least one value for \"value\" but have none")) + } + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + var _t_value: ValueX? = nil + if let valueCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueCode, auxiliaryKey: ._valueCode) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCode, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .code(valueCode) + } + if let valueCoding = try Coding(from: _container, forKeyIfPresent: .valueCoding) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCoding, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .coding(valueCoding) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInteger, auxiliaryKey: ._valueInteger) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInteger, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .integer(valueInteger) + } + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDateTime, auxiliaryKey: ._valueDateTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDateTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .dateTime(valueDateTime) + } + self.value = _t_value! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + + switch value { + case .code(let _value): + try _value.encode(on: &_container, forKey: .valueCode, auxiliaryKey: ._valueCode) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .valueCoding) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .valueInteger, auxiliaryKey: ._valueInteger) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .valueDateTime, auxiliaryKey: ._valueDateTime) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CodeSystemConceptProperty else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(value) + } +} + +/** + Filter that can be used in a value set. + + A filter that can be used in a value set compose statement when selecting concepts using a filter. + */ +open class CodeSystemFilter: BackboneElement { + + /// Code that identifies the filter + public var code: FHIRPrimitive + + /// How or why the filter is used + public var description_fhir: FHIRPrimitive? + + /// A list of operators that can be used with the filter. + public var `operator`: [FHIRPrimitive] + + /// What to use for the value + public var value: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, `operator`: [FHIRPrimitive], value: FHIRPrimitive) { + self.code = code + self.`operator` = `operator` + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + `operator`: [FHIRPrimitive], + value: FHIRPrimitive) + { + self.init(code: code, operator: `operator`, value: value) + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case description_fhir = "description"; case _description_fhir = "_description" + case `operator` = "operator"; case _operator = "_operator" + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.`operator` = try [FHIRPrimitive](from: _container, forKey: .`operator`, auxiliaryKey: ._operator) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try `operator`.encode(on: &_container, forKey: .`operator`, auxiliaryKey: ._operator) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CodeSystemFilter else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && description_fhir == _other.description_fhir + && `operator` == _other.`operator` + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(description_fhir) + hasher.combine(`operator`) + hasher.combine(value) + } +} + +/** + Additional information supplied about each concept. + + A property defines an additional slot through which additional information can be provided about a concept. + */ +open class CodeSystemProperty: BackboneElement { + + /// Identifies the property on the concepts, and when referred to in operations + public var code: FHIRPrimitive + + /// Formal identifier for the property + public var uri: FHIRPrimitive? + + /// Why the property is defined, and/or what it conveys + public var description_fhir: FHIRPrimitive? + + /// The type of the property value. Properties of type "code" contain a code defined by the code system (e.g. a + /// reference to anotherr defined concept). + public var type: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, type: FHIRPrimitive) { + self.code = code + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: FHIRPrimitive, + uri: FHIRPrimitive? = nil) + { + self.init(code: code, type: type) + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.uri = uri + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case description_fhir = "description"; case _description_fhir = "_description" + case type; case _type + case uri; case _uri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.uri = try FHIRPrimitive(from: _container, forKeyIfPresent: .uri, auxiliaryKey: ._uri) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try uri?.encode(on: &_container, forKey: .uri, auxiliaryKey: ._uri) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CodeSystemProperty else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && description_fhir == _other.description_fhir + && type == _other.type + && uri == _other.uri + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(description_fhir) + hasher.combine(type) + hasher.combine(uri) + } +} diff --git a/Sources/ModelsSTU3/CodeSystemAbstractType.swift b/Sources/ModelsSTU3/CodeSystemAbstractType.swift new file mode 100644 index 0000000..e0de16d --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAbstractType.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A type defined by FHIR that is an abstract type + + URL: http://hl7.org/fhir/abstract-types + ValueSet: http://hl7.org/fhir/ValueSet/abstract-types + */ +public enum AbstractType: String, FHIRPrimitiveType { + + /// A place holder that means any kind of data type + case type = "Type" + + /// A place holder that means any kind of resource + case any = "Any" +} diff --git a/Sources/ModelsSTU3/CodeSystemAccountStatus.swift b/Sources/ModelsSTU3/CodeSystemAccountStatus.swift new file mode 100644 index 0000000..9eb2c60 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAccountStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates whether the account is available to be used. + + URL: http://hl7.org/fhir/account-status + ValueSet: http://hl7.org/fhir/ValueSet/account-status + */ +public enum AccountStatus: String, FHIRPrimitiveType { + + /// This account is active and may be used. + case active = "active" + + /// This account is inactive and should not be used to track financial information. + case inactive = "inactive" + + /// This instance should not have been part of this patient's medical record. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemActionCardinalityBehavior.swift b/Sources/ModelsSTU3/CodeSystemActionCardinalityBehavior.swift new file mode 100644 index 0000000..498d9ea --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActionCardinalityBehavior.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines behavior for an action or a group for how many times that item may be repeated + + URL: http://hl7.org/fhir/action-cardinality-behavior + ValueSet: http://hl7.org/fhir/ValueSet/action-cardinality-behavior + */ +public enum ActionCardinalityBehavior: String, FHIRPrimitiveType { + + /// The action may only be selected one time + case single = "single" + + /// The action may be selected multiple times + case multiple = "multiple" +} diff --git a/Sources/ModelsSTU3/CodeSystemActionConditionKind.swift b/Sources/ModelsSTU3/CodeSystemActionConditionKind.swift new file mode 100644 index 0000000..387d0c3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActionConditionKind.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines the kinds of conditions that can appear on actions + + URL: http://hl7.org/fhir/action-condition-kind + ValueSet: http://hl7.org/fhir/ValueSet/action-condition-kind + */ +public enum ActionConditionKind: String, FHIRPrimitiveType { + + /// The condition describes whether or not a given action is applicable + case applicability = "applicability" + + /// The condition is a starting condition for the action + case start = "start" + + /// The condition is a stop, or exit condition for the action + case stop = "stop" +} diff --git a/Sources/ModelsSTU3/CodeSystemActionGroupingBehavior.swift b/Sources/ModelsSTU3/CodeSystemActionGroupingBehavior.swift new file mode 100644 index 0000000..3293024 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActionGroupingBehavior.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines organization behavior of a group + + URL: http://hl7.org/fhir/action-grouping-behavior + ValueSet: http://hl7.org/fhir/ValueSet/action-grouping-behavior + */ +public enum ActionGroupingBehavior: String, FHIRPrimitiveType { + + /// Any group marked with this behavior should be displayed as a visual group to the end user + case visualGroup = "visual-group" + + /// A group with this behavior logically groups its sub-elements, and may be shown as a visual group to the end + /// user, but it is not required to do so + case logicalGroup = "logical-group" + + /// A group of related alternative actions is a sentence group if the target referenced by the action is the same in + /// all the actions and each action simply constitutes a different variation on how to specify the details for the + /// target. For example, two actions that could be in a SentenceGroup are "aspirin, 500 mg, 2 times per day" and + /// "aspirin, 300 mg, 3 times per day". In both cases, aspirin is the target referenced by the action, and the two + /// actions represent different options for how aspirin might be ordered for the patient. Note that a SentenceGroup + /// would almost always have an associated selection behavior of "AtMostOne", unless it's a required action, in + /// which case, it would be "ExactlyOne" + case sentenceGroup = "sentence-group" +} diff --git a/Sources/ModelsSTU3/CodeSystemActionList.swift b/Sources/ModelsSTU3/CodeSystemActionList.swift new file mode 100644 index 0000000..56997eb --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActionList.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + List of allowable action which this resource can request. + + URL: http://hl7.org/fhir/actionlist + ValueSet: http://hl7.org/fhir/ValueSet/actionlist + */ +public enum ActionList: String, FHIRPrimitiveType { + + /// Cancel, reverse or nullify the target resource. + case cancel = "cancel" + + /// Check for previously un-read/ not-retrieved resources. + case poll = "poll" + + /// Re-process the target resource. + case reprocess = "reprocess" + + /// Retrieve the processing status of the target resource. + case status = "status" +} diff --git a/Sources/ModelsSTU3/CodeSystemActionParticipantType.swift b/Sources/ModelsSTU3/CodeSystemActionParticipantType.swift new file mode 100644 index 0000000..ce842ee --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActionParticipantType.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of participant for the action + + URL: http://hl7.org/fhir/action-participant-type + ValueSet: http://hl7.org/fhir/ValueSet/action-participant-type + */ +public enum ActionParticipantType: String, FHIRPrimitiveType { + + /// The participant is the patient under evaluation + case patient = "patient" + + /// The participant is a practitioner involved in the patient's care + case practitioner = "practitioner" + + /// The participant is a person related to the patient + case relatedPerson = "related-person" +} diff --git a/Sources/ModelsSTU3/CodeSystemActionPrecheckBehavior.swift b/Sources/ModelsSTU3/CodeSystemActionPrecheckBehavior.swift new file mode 100644 index 0000000..d60f746 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActionPrecheckBehavior.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines selection frequency behavior for an action or group + + URL: http://hl7.org/fhir/action-precheck-behavior + ValueSet: http://hl7.org/fhir/ValueSet/action-precheck-behavior + */ +public enum ActionPrecheckBehavior: String, FHIRPrimitiveType { + + /// An action with this behavior is one of the most frequent action that is, or should be, included by an end user, + /// for the particular context in which the action occurs. The system displaying the action to the end user should + /// consider "pre-checking" such an action as a convenience for the user + case yes = "yes" + + /// An action with this behavior is one of the less frequent actions included by the end user, for the particular + /// context in which the action occurs. The system displaying the actions to the end user would typically not "pre- + /// check" such an action + case no = "no" +} diff --git a/Sources/ModelsSTU3/CodeSystemActionRelationshipType.swift b/Sources/ModelsSTU3/CodeSystemActionRelationshipType.swift new file mode 100644 index 0000000..a838298 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActionRelationshipType.swift @@ -0,0 +1,56 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines the types of relationships between actions + + URL: http://hl7.org/fhir/action-relationship-type + ValueSet: http://hl7.org/fhir/ValueSet/action-relationship-type + */ +public enum ActionRelationshipType: String, FHIRPrimitiveType { + + /// The action must be performed before the start of the related action + case beforeStart = "before-start" + + /// The action must be performed before the related action + case before = "before" + + /// The action must be performed before the end of the related action + case beforeEnd = "before-end" + + /// The action must be performed concurrent with the start of the related action + case concurrentWithStart = "concurrent-with-start" + + /// The action must be performed concurrent with the related action + case concurrent = "concurrent" + + /// The action must be performed concurrent with the end of the related action + case concurrentWithEnd = "concurrent-with-end" + + /// The action must be performed after the start of the related action + case afterStart = "after-start" + + /// The action must be performed after the related action + case after = "after" + + /// The action must be performed after the end of the related action + case afterEnd = "after-end" +} diff --git a/Sources/ModelsSTU3/CodeSystemActionRequiredBehavior.swift b/Sources/ModelsSTU3/CodeSystemActionRequiredBehavior.swift new file mode 100644 index 0000000..f4ee765 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActionRequiredBehavior.swift @@ -0,0 +1,40 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines requiredness behavior for selecting an action or an action group + + URL: http://hl7.org/fhir/action-required-behavior + ValueSet: http://hl7.org/fhir/ValueSet/action-required-behavior + */ +public enum ActionRequiredBehavior: String, FHIRPrimitiveType { + + /// An action with this behavior must be included in the actions processed by the end user; the end user may not + /// choose not to include this action + case must = "must" + + /// An action with this behavior may be included in the set of actions processed by the end user + case could = "could" + + /// An action with this behavior must be included in the set of actions processed by the end user, unless the end + /// user provides documentation as to why the action was not included + case mustUnlessDocumented = "must-unless-documented" +} diff --git a/Sources/ModelsSTU3/CodeSystemActionSelectionBehavior.swift b/Sources/ModelsSTU3/CodeSystemActionSelectionBehavior.swift new file mode 100644 index 0000000..f95c24b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActionSelectionBehavior.swift @@ -0,0 +1,49 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines selection behavior of a group + + URL: http://hl7.org/fhir/action-selection-behavior + ValueSet: http://hl7.org/fhir/ValueSet/action-selection-behavior + */ +public enum ActionSelectionBehavior: String, FHIRPrimitiveType { + + /// Any number of the actions in the group may be chosen, from zero to all + case any = "any" + + /// All the actions in the group must be selected as a single unit + case all = "all" + + /// All the actions in the group are meant to be chosen as a single unit: either all must be selected by the end + /// user, or none may be selected + case allOrNone = "all-or-none" + + /// The end user must choose one and only one of the selectable actions in the group. The user may not choose none + /// of the actions in the group + case exactlyOne = "exactly-one" + + /// The end user may choose zero or at most one of the actions in the group + case atMostOne = "at-most-one" + + /// The end user must choose a minimum of one, and as many additional as desired + case oneOrMore = "one-or-more" +} diff --git a/Sources/ModelsSTU3/CodeSystemActionType.swift b/Sources/ModelsSTU3/CodeSystemActionType.swift new file mode 100644 index 0000000..f2590e2 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActionType.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of action to be performed + + URL: http://hl7.org/fhir/action-type + ValueSet: http://hl7.org/fhir/ValueSet/action-type + */ +public enum ActionType: String, FHIRPrimitiveType { + + /// The action is to create a new resource + case create = "create" + + /// The action is to update an existing resource + case update = "update" + + /// The action is to remove an existing resource + case remove = "remove" + + /// The action is to fire a specific event + case fireEvent = "fire-event" +} diff --git a/Sources/ModelsSTU3/CodeSystemActivityDefinitionCategory.swift b/Sources/ModelsSTU3/CodeSystemActivityDefinitionCategory.swift new file mode 100644 index 0000000..28425f5 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemActivityDefinitionCategory.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + High-level categorization of the type of activity + + URL: http://hl7.org/fhir/activity-definition-category + ValueSet: http://hl7.org/fhir/ValueSet/activity-definition-category + */ +public enum ActivityDefinitionCategory: String, FHIRPrimitiveType { + + /// The activity is intended to provide or is related to treatment of the patient + case treatment = "treatment" + + /// The activity is intended to provide or is related to education of the patient + case education = "education" + + /// The activity is intended to perform or is related to assessment of the patient + case assessment = "assessment" +} diff --git a/Sources/ModelsSTU3/CodeSystemAddressType.swift b/Sources/ModelsSTU3/CodeSystemAddressType.swift new file mode 100644 index 0000000..28ef583 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAddressType.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of an address (physical / postal) + + URL: http://hl7.org/fhir/address-type + ValueSet: http://hl7.org/fhir/ValueSet/address-type + */ +public enum AddressType: String, FHIRPrimitiveType { + + /// Mailing addresses - PO Boxes and care-of addresses. + case postal = "postal" + + /// A physical address that can be visited. + case physical = "physical" + + /// An address that is both physical and postal. + case both = "both" +} diff --git a/Sources/ModelsSTU3/CodeSystemAddressUse.swift b/Sources/ModelsSTU3/CodeSystemAddressUse.swift new file mode 100644 index 0000000..64d0069 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAddressUse.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The use of an address + + URL: http://hl7.org/fhir/address-use + ValueSet: http://hl7.org/fhir/ValueSet/address-use + */ +public enum AddressUse: String, FHIRPrimitiveType { + + /// A communication address at a home. + case home = "home" + + /// An office address. First choice for business related contacts during business hours. + case work = "work" + + /// A temporary address. The period can provide more detailed information. + case temp = "temp" + + /// This address is no longer in use (or was never correct, but retained for records). + case old = "old" +} diff --git a/Sources/ModelsSTU3/CodeSystemAdministrativeGender.swift b/Sources/ModelsSTU3/CodeSystemAdministrativeGender.swift new file mode 100644 index 0000000..440baba --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAdministrativeGender.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The gender of a person used for administrative purposes. + + URL: http://hl7.org/fhir/administrative-gender + ValueSet: http://hl7.org/fhir/ValueSet/administrative-gender + */ +public enum AdministrativeGender: String, FHIRPrimitiveType { + + /// Male + case male = "male" + + /// Female + case female = "female" + + /// Other + case other = "other" + + /// Unknown + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemAdverseEventCategory.swift b/Sources/ModelsSTU3/CodeSystemAdverseEventCategory.swift new file mode 100644 index 0000000..c6aefaa --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAdverseEventCategory.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Overall categorization of the event, e.g. real or potential + + URL: http://hl7.org/fhir/adverse-event-category + ValueSet: http://hl7.org/fhir/ValueSet/adverse-event-category + */ +public enum AdverseEventCategory: String, FHIRPrimitiveType { + + /// AE + case AE = "AE" + + /// PAE + case PAE = "PAE" +} diff --git a/Sources/ModelsSTU3/CodeSystemAdverseEventCausality.swift b/Sources/ModelsSTU3/CodeSystemAdverseEventCausality.swift new file mode 100644 index 0000000..fd9b4fa --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAdverseEventCausality.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + TODO + + URL: http://hl7.org/fhir/adverse-event-causality + ValueSet: http://hl7.org/fhir/ValueSet/adverse-event-causality + */ +public enum AdverseEventCausality: String, FHIRPrimitiveType { + + /// causality1 + case causality1 = "causality1" + + /// causality2 + case causality2 = "causality2" +} diff --git a/Sources/ModelsSTU3/CodeSystemAdverseEventCausalityAssessment.swift b/Sources/ModelsSTU3/CodeSystemAdverseEventCausalityAssessment.swift new file mode 100644 index 0000000..77bf883 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAdverseEventCausalityAssessment.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + TODO + + URL: http://hl7.org/fhir/adverse-event-causality-assess + ValueSet: http://hl7.org/fhir/ValueSet/adverse-event-causality-assess + */ +public enum AdverseEventCausalityAssessment: String, FHIRPrimitiveType { + + /// assess1 + case assess1 = "assess1" + + /// assess2 + case assess2 = "assess2" +} diff --git a/Sources/ModelsSTU3/CodeSystemAdverseEventCausalityMethod.swift b/Sources/ModelsSTU3/CodeSystemAdverseEventCausalityMethod.swift new file mode 100644 index 0000000..51888fb --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAdverseEventCausalityMethod.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + TODO + + URL: http://hl7.org/fhir/adverse-event-causality-method + ValueSet: http://hl7.org/fhir/ValueSet/adverse-event-causality-method + */ +public enum AdverseEventCausalityMethod: String, FHIRPrimitiveType { + + /// method1 + case method1 = "method1" + + /// method2 + case method2 = "method2" +} diff --git a/Sources/ModelsSTU3/CodeSystemAdverseEventCausalityResult.swift b/Sources/ModelsSTU3/CodeSystemAdverseEventCausalityResult.swift new file mode 100644 index 0000000..07d7353 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAdverseEventCausalityResult.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + TODO + + URL: http://hl7.org/fhir/adverse-event-causality-result + ValueSet: http://hl7.org/fhir/ValueSet/adverse-event-causality-result + */ +public enum AdverseEventCausalityResult: String, FHIRPrimitiveType { + + /// result1 + case result1 = "result1" + + /// result2 + case result2 = "result2" +} diff --git a/Sources/ModelsSTU3/CodeSystemAdverseEventOutcome.swift b/Sources/ModelsSTU3/CodeSystemAdverseEventOutcome.swift new file mode 100644 index 0000000..3d99092 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAdverseEventOutcome.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + TODO (and should this be required?) + + URL: http://hl7.org/fhir/adverse-event-outcome + ValueSet: http://hl7.org/fhir/ValueSet/adverse-event-outcome + */ +public enum AdverseEventOutcome: String, FHIRPrimitiveType { + + /// resolved + case resolved = "resolved" + + /// recovering + case recovering = "recovering" + + /// ongoing + case ongoing = "ongoing" + + /// resolvedWithSequelae + case resolvedWithSequelae = "resolvedWithSequelae" + + /// fatal + case fatal = "fatal" + + /// unknown + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemAdverseEventSeriousness.swift b/Sources/ModelsSTU3/CodeSystemAdverseEventSeriousness.swift new file mode 100644 index 0000000..d0eeab1 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAdverseEventSeriousness.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Overall seriousness of this event for the patient + + URL: http://hl7.org/fhir/adverse-event-seriousness + ValueSet: http://hl7.org/fhir/ValueSet/adverse-event-seriousness + */ +public enum AdverseEventSeriousness: String, FHIRPrimitiveType { + + /// mild + case mild = "Mild" + + /// moderate + case moderate = "Moderate" + + /// severe + case severe = "Severe" +} diff --git a/Sources/ModelsSTU3/CodeSystemAggregationMode.swift b/Sources/ModelsSTU3/CodeSystemAggregationMode.swift new file mode 100644 index 0000000..91a4ae7 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAggregationMode.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How resource references can be aggregated. + + URL: http://hl7.org/fhir/resource-aggregation-mode + ValueSet: http://hl7.org/fhir/ValueSet/resource-aggregation-mode + */ +public enum AggregationMode: String, FHIRPrimitiveType { + + /// The reference is a local reference to a contained resource. + case contained = "contained" + + /// The reference to a resource that has to be resolved externally to the resource that includes the reference. + case referenced = "referenced" + + /// The resource the reference points to will be found in the same bundle as the resource that includes the + /// reference. + case bundled = "bundled" +} diff --git a/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceCategory.swift b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceCategory.swift new file mode 100644 index 0000000..aee365b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceCategory.swift @@ -0,0 +1,46 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Category of an identified substance. + + URL: http://hl7.org/fhir/allergy-intolerance-category + ValueSet: http://hl7.org/fhir/ValueSet/allergy-intolerance-category + */ +public enum AllergyIntoleranceCategory: String, FHIRPrimitiveType { + + /// Any substance consumed to provide nutritional support for the body. + case food = "food" + + /// Substances administered to achieve a physiological effect. + case medication = "medication" + + /// Any substances that are encountered in the environment, including any substance not already classified as food, + /// medication, or biologic. + case environment = "environment" + + /// A preparation that is synthesized from living organisms or their products, especially a human or animal protein, + /// such as a hormone or antitoxin, that is used as a diagnostic, preventive, or therapeutic agent. Examples of + /// biologic medications include: vaccines; allergenic extracts, which are used for both diagnosis and treatment + /// (for example, allergy shots); gene therapies; cellular therapies. There are other biologic products, such as + /// tissues, that are not typically associated with allergies. + case biologic = "biologic" +} diff --git a/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceCertainty.swift b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceCertainty.swift new file mode 100644 index 0000000..2553cfa --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceCertainty.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Statement about the degree of clinical certainty that a specific substance was the cause of the manifestation in a + reaction event. + + URL: http://hl7.org/fhir/reaction-event-certainty + ValueSet: http://hl7.org/fhir/ValueSet/reaction-event-certainty + */ +public enum AllergyIntoleranceCertainty: String, FHIRPrimitiveType { + + /// There is a low level of clinical certainty that the reaction was caused by the identified substance. + case unlikely = "unlikely" + + /// There is a high level of clinical certainty that the reaction was caused by the identified substance. + case likely = "likely" + + /// There is a very high level of clinical certainty that the reaction was due to the identified substance, which + /// may include clinical evidence by testing or rechallenge. + case confirmed = "confirmed" + + /// The clinical certainty that the reaction was caused by the identified substance is unknown. It is an explicit + /// assertion that certainty is not known. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceClinicalStatus.swift b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceClinicalStatus.swift new file mode 100644 index 0000000..a537d2c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceClinicalStatus.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The clinical status of the allergy or intolerance. + + URL: http://hl7.org/fhir/allergy-clinical-status + ValueSet: http://hl7.org/fhir/ValueSet/allergy-clinical-status + */ +public enum AllergyIntoleranceClinicalStatus: String, FHIRPrimitiveType { + + /// An active record of a risk of a reaction to the identified substance. + case active = "active" + + /// An inactivated record of a risk of a reaction to the identified substance. + case inactive = "inactive" + + /// A reaction to the identified substance has been clinically reassessed by testing or re-exposure and considered + /// to be resolved. + case resolved = "resolved" +} diff --git a/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceCriticality.swift b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceCriticality.swift new file mode 100644 index 0000000..bd6292d --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceCriticality.swift @@ -0,0 +1,40 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Estimate of the potential clinical harm, or seriousness, of a reaction to an identified substance. + + URL: http://hl7.org/fhir/allergy-intolerance-criticality + ValueSet: http://hl7.org/fhir/ValueSet/allergy-intolerance-criticality + */ +public enum AllergyIntoleranceCriticality: String, FHIRPrimitiveType { + + /// Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ + /// system failure. + case low = "low" + + /// Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ + /// system failure. + case high = "high" + + /// Unable to assess the worst case result of a future exposure. + case unableToAssess = "unable-to-assess" +} diff --git a/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceSeverity.swift b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceSeverity.swift new file mode 100644 index 0000000..24ce1e3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceSeverity.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Clinical assessment of the severity of a reaction event as a whole, potentially considering multiple different + manifestations. + + URL: http://hl7.org/fhir/reaction-event-severity + ValueSet: http://hl7.org/fhir/ValueSet/reaction-event-severity + */ +public enum AllergyIntoleranceSeverity: String, FHIRPrimitiveType { + + /// Causes mild physiological effects. + case mild = "mild" + + /// Causes moderate physiological effects. + case moderate = "moderate" + + /// Causes severe physiological effects. + case severe = "severe" +} diff --git a/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceSubstanceExposureRisk.swift b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceSubstanceExposureRisk.swift new file mode 100644 index 0000000..360bccc --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceSubstanceExposureRisk.swift @@ -0,0 +1,36 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The risk of an adverse reaction (allergy or intolerance) for this patient upon exposure to the substance (including + pharmaceutical products). + + URL: http://hl7.org/fhir/allerg-intol-substance-exp-risk + ValueSet: http://hl7.org/fhir/ValueSet/allerg-intol-substance-exp-risk + */ +public enum AllergyIntoleranceSubstanceExposureRisk: String, FHIRPrimitiveType { + + /// Known risk of allergy or intolerance reaction upon exposure to the specified substance. + case knownReactionRisk = "known-reaction-risk" + + /// No known risk of allergy or intolerance reaction upon exposure to the specified substance. + case noKnownReactionRisk = "no-known-reaction-risk" +} diff --git a/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceType.swift b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceType.swift new file mode 100644 index 0000000..13f3871 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceType.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Identification of the underlying physiological mechanism for a Reaction Risk. + + URL: http://hl7.org/fhir/allergy-intolerance-type + ValueSet: http://hl7.org/fhir/ValueSet/allergy-intolerance-type + */ +public enum AllergyIntoleranceType: String, FHIRPrimitiveType { + + /// A propensity for hypersensitivity reaction(s) to a substance. These reactions are most typically type I + /// hypersensitivity, plus other "allergy-like" reactions, including pseudoallergy. + case allergy = "allergy" + + /// A propensity for adverse reactions to a substance that is not judged to be allergic or "allergy-like". These + /// reactions are typically (but not necessarily) non-immune. They are to some degree idiosyncratic and/or + /// individually specific (i.e. are not a reaction that is expected to occur with most or all patients given similar + /// circumstances). + case intolerance = "intolerance" +} diff --git a/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceVerificationStatus.swift b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceVerificationStatus.swift new file mode 100644 index 0000000..ad0680c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAllergyIntoleranceVerificationStatus.swift @@ -0,0 +1,43 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Assertion about certainty associated with a propensity, or potential risk, of a reaction to the identified substance. + + URL: http://hl7.org/fhir/allergy-verification-status + ValueSet: http://hl7.org/fhir/ValueSet/allergy-verification-status + */ +public enum AllergyIntoleranceVerificationStatus: String, FHIRPrimitiveType { + + /// A low level of certainty about the propensity for a reaction to the identified substance. + case unconfirmed = "unconfirmed" + + /// A high level of certainty about the propensity for a reaction to the identified substance, which may include + /// clinical evidence by testing or rechallenge. + case confirmed = "confirmed" + + /// A propensity for a reaction to the identified substance has been disproven with a high level of clinical + /// certainty, which may include testing or rechallenge, and is refuted. + case refuted = "refuted" + + /// The statement was entered in error and is not valid. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemAppointmentStatus.swift b/Sources/ModelsSTU3/CodeSystemAppointmentStatus.swift new file mode 100644 index 0000000..390363b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAppointmentStatus.swift @@ -0,0 +1,55 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The free/busy status of an appointment. + + URL: http://hl7.org/fhir/appointmentstatus + ValueSet: http://hl7.org/fhir/ValueSet/appointmentstatus + */ +public enum AppointmentStatus: String, FHIRPrimitiveType { + + /// None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time + /// may not be set yet. + case proposed = "proposed" + + /// Some or all of the participant(s) have not finalized their acceptance of the appointment request. + case pending = "pending" + + /// All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times + /// specified. + case booked = "booked" + + /// Some of the patients have arrived. + case arrived = "arrived" + + /// This appointment has completed and may have resulted in an encounter. + case fulfilled = "fulfilled" + + /// The appointment has been cancelled. + case cancelled = "cancelled" + + /// Some or all of the participant(s) have not/did not appear for the appointment (usually the patient). + case noshow = "noshow" + + /// This instance should not have been part of this patient's medical record. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemAssertionDirectionType.swift b/Sources/ModelsSTU3/CodeSystemAssertionDirectionType.swift new file mode 100644 index 0000000..2168588 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAssertionDirectionType.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of direction to use for assertion. + + URL: http://hl7.org/fhir/assert-direction-codes + ValueSet: http://hl7.org/fhir/ValueSet/assert-direction-codes + */ +public enum AssertionDirectionType: String, FHIRPrimitiveType { + + /// The assertion is evaluated on the response. This is the default value. + case response = "response" + + /// The assertion is evaluated on the request. + case request = "request" +} diff --git a/Sources/ModelsSTU3/CodeSystemAssertionOperatorType.swift b/Sources/ModelsSTU3/CodeSystemAssertionOperatorType.swift new file mode 100644 index 0000000..9586d01 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAssertionOperatorType.swift @@ -0,0 +1,62 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of operator to use for assertion. + + URL: http://hl7.org/fhir/assert-operator-codes + ValueSet: http://hl7.org/fhir/ValueSet/assert-operator-codes + */ +public enum AssertionOperatorType: String, FHIRPrimitiveType { + + /// Default value. Equals comparison. + case equals = "equals" + + /// Not equals comparison. + case notEquals = "notEquals" + + /// Compare value within a known set of values. + case `in` = "in" + + /// Compare value not within a known set of values. + case notIn = "notIn" + + /// Compare value to be greater than a known value. + case greaterThan = "greaterThan" + + /// Compare value to be less than a known value. + case lessThan = "lessThan" + + /// Compare value is empty. + case empty = "empty" + + /// Compare value is not empty. + case notEmpty = "notEmpty" + + /// Compare value string contains a known value. + case contains = "contains" + + /// Compare value string does not contain a known value. + case notContains = "notContains" + + /// Evaluate the fluentpath expression as a boolean condition. + case eval = "eval" +} diff --git a/Sources/ModelsSTU3/CodeSystemAssertionResponseTypes.swift b/Sources/ModelsSTU3/CodeSystemAssertionResponseTypes.swift new file mode 100644 index 0000000..40d018e --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAssertionResponseTypes.swift @@ -0,0 +1,65 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of response code to use for assertion. + + URL: http://hl7.org/fhir/assert-response-code-types + ValueSet: http://hl7.org/fhir/ValueSet/assert-response-code-types + */ +public enum AssertionResponseTypes: String, FHIRPrimitiveType { + + /// Response code is 200. + case okay = "okay" + + /// Response code is 201. + case created = "created" + + /// Response code is 204. + case noContent = "noContent" + + /// Response code is 304. + case notModified = "notModified" + + /// Response code is 400. + case bad = "bad" + + /// Response code is 403. + case forbidden = "forbidden" + + /// Response code is 404. + case notFound = "notFound" + + /// Response code is 405. + case methodNotAllowed = "methodNotAllowed" + + /// Response code is 409. + case conflict = "conflict" + + /// Response code is 410. + case gone = "gone" + + /// Response code is 412. + case preconditionFailed = "preconditionFailed" + + /// Response code is 422. + case unprocessable = "unprocessable" +} diff --git a/Sources/ModelsSTU3/CodeSystemAuditEventAction.swift b/Sources/ModelsSTU3/CodeSystemAuditEventAction.swift new file mode 100644 index 0000000..d349cb1 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemAuditEventAction.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicator for type of action performed during the event that generated the event + + URL: http://hl7.org/fhir/audit-event-action + ValueSet: http://hl7.org/fhir/ValueSet/audit-event-action + */ +public enum AuditEventAction: String, FHIRPrimitiveType { + + /// Create a new database object, such as placing an order. + case C = "C" + + /// Display or print data, such as a doctor census. + case R = "R" + + /// Update data, such as revise patient information. + case U = "U" + + /// Delete items, such as a doctor master file record. + case D = "D" + + /// Perform a system or application function such as log-on, program execution or use of an object's method, or + /// perform a query/search operation. + case E = "E" +} diff --git a/Sources/ModelsSTU3/CodeSystemBindingStrength.swift b/Sources/ModelsSTU3/CodeSystemBindingStrength.swift new file mode 100644 index 0000000..6de5786 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemBindingStrength.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indication of the degree of conformance expectations associated with a binding. + + URL: http://hl7.org/fhir/binding-strength + ValueSet: http://hl7.org/fhir/ValueSet/binding-strength + */ +public enum BindingStrength: String, FHIRPrimitiveType { + + /// To be conformant, the concept in this element SHALL be from the specified value set + case required = "required" + + /// To be conformant, the concept in this element SHALL be from the specified value set if any of the codes within + /// the value set can apply to the concept being communicated. If the value set does not cover the concept (based + /// on human review), alternate codings (or, data type allowing, text) may be included instead. + case extensible = "extensible" + + /// Instances are encouraged to draw from the specified codes for interoperability purposes but are not required to + /// do so to be considered conformant. + case preferred = "preferred" + + /// Instances are not expected or even encouraged to draw from the specified value set. The value set merely + /// provides examples of the types of concepts intended to be included. + case example = "example" +} diff --git a/Sources/ModelsSTU3/CodeSystemBundleType.swift b/Sources/ModelsSTU3/CodeSystemBundleType.swift new file mode 100644 index 0000000..8548fe3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemBundleType.swift @@ -0,0 +1,57 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates the purpose of a bundle - how it was intended to be used. + + URL: http://hl7.org/fhir/bundle-type + ValueSet: http://hl7.org/fhir/ValueSet/bundle-type + */ +public enum BundleType: String, FHIRPrimitiveType { + + /// The bundle is a document. The first resource is a Composition. + case document = "document" + + /// The bundle is a message. The first resource is a MessageHeader. + case message = "message" + + /// The bundle is a transaction - intended to be processed by a server as an atomic commit. + case transaction = "transaction" + + /// The bundle is a transaction response. Because the response is a transaction response, the transaction has + /// succeeded, and all responses are error free. + case transactionResponse = "transaction-response" + + /// The bundle is a transaction - intended to be processed by a server as a group of actions. + case batch = "batch" + + /// The bundle is a batch response. Note that as a batch, some responses may indicate failure and others success. + case batchResponse = "batch-response" + + /// The bundle is a list of resources from a history interaction on a server. + case history = "history" + + /// The bundle is a list of resources returned as a result of a search/query interaction, operation, or message. + case searchset = "searchset" + + /// The bundle is a set of resources collected into a single package for ease of distribution. + case collection = "collection" +} diff --git a/Sources/ModelsSTU3/CodeSystemCapabilityStatementKind.swift b/Sources/ModelsSTU3/CodeSystemCapabilityStatementKind.swift new file mode 100644 index 0000000..293e534 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCapabilityStatementKind.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How a capability statement is intended to be used. + + URL: http://hl7.org/fhir/capability-statement-kind + ValueSet: http://hl7.org/fhir/ValueSet/capability-statement-kind + */ +public enum CapabilityStatementKind: String, FHIRPrimitiveType { + + /// The CapabilityStatement instance represents the present capabilities of a specific system instance. This is the + /// kind returned by OPTIONS for a FHIR server end-point. + case instance = "instance" + + /// The CapabilityStatement instance represents the capabilities of a system or piece of software, independent of a + /// particular installation. + case capability = "capability" + + /// The CapabilityStatement instance represents a set of requirements for other systems to meet; e.g. as part of an + /// implementation guide or 'request for proposal'. + case requirements = "requirements" +} diff --git a/Sources/ModelsSTU3/CodeSystemCarePlanActivityStatus.swift b/Sources/ModelsSTU3/CodeSystemCarePlanActivityStatus.swift new file mode 100644 index 0000000..2531fad --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCarePlanActivityStatus.swift @@ -0,0 +1,50 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates where the activity is at in its overall life cycle. + + URL: http://hl7.org/fhir/care-plan-activity-status + ValueSet: http://hl7.org/fhir/ValueSet/care-plan-activity-status + */ +public enum CarePlanActivityStatus: String, FHIRPrimitiveType { + + /// Activity is planned but no action has yet been taken. + case notStarted = "not-started" + + /// Appointment or other booking has occurred but activity has not yet begun. + case scheduled = "scheduled" + + /// Activity has been started but is not yet complete. + case inProgress = "in-progress" + + /// Activity was started but has temporarily ceased with an expectation of resumption at a future time. + case onHold = "on-hold" + + /// The activities have been completed (more or less) as planned. + case completed = "completed" + + /// The activities have been ended prior to completion (perhaps even before they were started). + case cancelled = "cancelled" + + /// The authoring system doesn't know the current state of the activity. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemCarePlanIntent.swift b/Sources/ModelsSTU3/CodeSystemCarePlanIntent.swift new file mode 100644 index 0000000..ae8dcc9 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCarePlanIntent.swift @@ -0,0 +1,46 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes indicating the degree of authority/intentionality associated with a care plan + + URL: http://hl7.org/fhir/care-plan-intent + ValueSet: http://hl7.org/fhir/ValueSet/care-plan-intent + */ +public enum CarePlanIntent: String, FHIRPrimitiveType { + + /// The care plan is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and + /// without providing an authorization to act + case proposal = "proposal" + + /// The care plan represents an intention to ensure something occurs without providing an authorization for others + /// to act + case plan = "plan" + + /// The care plan represents a request/demand and authorization for action + case order = "order" + + /// The care plan represents a component or option for a RequestGroup that establishes timing, conditionality and/or + /// other constraints among a set of requests. + /// + /// Refer to [[[RequestGroup]]] for additional information on how this status is used + case option = "option" +} diff --git a/Sources/ModelsSTU3/CodeSystemCarePlanStatus.swift b/Sources/ModelsSTU3/CodeSystemCarePlanStatus.swift new file mode 100644 index 0000000..fb4c40b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCarePlanStatus.swift @@ -0,0 +1,50 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record. + + URL: http://hl7.org/fhir/care-plan-status + ValueSet: http://hl7.org/fhir/ValueSet/care-plan-status + */ +public enum CarePlanStatus: String, FHIRPrimitiveType { + + /// The plan is in development or awaiting use but is not yet intended to be acted upon. + case draft = "draft" + + /// The plan is intended to be followed and used as part of patient care. + case active = "active" + + /// The plan has been temporarily stopped but is expected to resume in the future. + case suspended = "suspended" + + /// The plan is no longer in use and is not expected to be followed or used in patient care. + case completed = "completed" + + /// The plan was entered in error and voided. + case enteredInError = "entered-in-error" + + /// The plan has been terminated prior to reaching completion (though it may have been replaced by a new plan). + case cancelled = "cancelled" + + /// The authoring system doesn't know the current state of the care plan. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemCareTeamCategory.swift b/Sources/ModelsSTU3/CodeSystemCareTeamCategory.swift new file mode 100644 index 0000000..d681ed3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCareTeamCategory.swift @@ -0,0 +1,58 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates the type of care team. + + URL: http://hl7.org/fhir/care-team-category + ValueSet: http://hl7.org/fhir/ValueSet/care-team-category + */ +public enum CareTeamCategory: String, FHIRPrimitiveType { + + /// This type of team focuses on one specific type of incident, which is non-patient specific. The incident is + /// determined by the context of use. For example, code team (code red, code blue, medical emergency treatment) or + /// the PICC line team. + case event = "event" + + /// This type of team focuses on one specific encounter. The encounter is determined by the context of use. For + /// example, during an inpatient encounter, the nutrition support care team + case encounter = "encounter" + + /// This type of team focuses on one specific episode of care with a defined time period or self-limiting process + /// (e.g. 10 visits). The episode of care is determined by the context of use. For example, a maternity care team + /// over 9 months. + case episode = "episode" + + /// This type of team focuses on overall care coordination managing one or more conditions across the continuum of + /// care ensuring there are smooth transitions of care. The members of the team are determined or selected by an + /// individual or organization. When determined by an organization, the team may be assigned or based on the + /// person's enrollment in a particular program. For example, disease management team or patient centered medical + /// home team. + case longitudinal = "longitudinal" + + /// This type of team focuses on one specific condition. The condition is determined by the context of use. For + /// example, a disease management team focused on one condition (e.g. diabetes). + case condition = "condition" + + /// This type of team is responsible for establishing, conducting, coordinating and monitoring the outcomes of + /// clinical trials. The team focuses on research, clinical care and education. + case clinicalResearch = "clinical-research" +} diff --git a/Sources/ModelsSTU3/CodeSystemCareTeamStatus.swift b/Sources/ModelsSTU3/CodeSystemCareTeamStatus.swift new file mode 100644 index 0000000..3c85949 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCareTeamStatus.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates the status of the care team. + + URL: http://hl7.org/fhir/care-team-status + ValueSet: http://hl7.org/fhir/ValueSet/care-team-status + */ +public enum CareTeamStatus: String, FHIRPrimitiveType { + + /// The care team has been drafted and proposed, but not yet participating in the coordination and delivery of care. + case proposed = "proposed" + + /// The care team is currently participating in the coordination and delivery of care. + case active = "active" + + /// The care team is temporarily on hold or suspended and not participating in the coordination and delivery of + /// care. + case suspended = "suspended" + + /// The care team was, but is no longer, participating in the coordination and delivery of care. + case inactive = "inactive" + + /// The care team should have never existed. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemChargeItemStatus.swift b/Sources/ModelsSTU3/CodeSystemChargeItemStatus.swift new file mode 100644 index 0000000..c44324c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemChargeItemStatus.swift @@ -0,0 +1,54 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes identifying the stage lifecycle stage of a ChargeItem + + URL: http://hl7.org/fhir/chargeitem-status + ValueSet: http://hl7.org/fhir/ValueSet/chargeitem-status + */ +public enum ChargeItemStatus: String, FHIRPrimitiveType { + + /// The charge item has been entered, but the charged service is not yet complete, so it shall not be billed yet + /// but might be used in the context of pre-authorization + case planned = "planned" + + /// The charge item is ready for billing + case billable = "billable" + + /// The charge item has been determined to be not billable (e.g. due to rules associated with the billing code) + case notBillable = "not-billable" + + /// The processing of the charge was aborted + case aborted = "aborted" + + /// The charge item has been billed (e.g. a billing engine has generated financial transactions by applying the + /// associated ruled for the charge item to the context of the Encounter, and placed them into Claims/Invoices + case billed = "billed" + + /// The charge item has been entered in error and should not be processed for billing + case enteredInError = "entered-in-error" + + /// The authoring system does not know which of the status values currently applies for this charge item Note: This + /// concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known + /// which one. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemChoiceListOrientation.swift b/Sources/ModelsSTU3/CodeSystemChoiceListOrientation.swift new file mode 100644 index 0000000..bf02b47 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemChoiceListOrientation.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Direction in which lists of question options should be displayed + + URL: http://hl7.org/fhir/choice-list-orientation + ValueSet: http://hl7.org/fhir/ValueSet/choice-list-orientation + */ +public enum ChoiceListOrientation: String, FHIRPrimitiveType { + + /// List choices along the horizontal axis + case horizontal = "horizontal" + + /// List choices down the vertical axis + case vertical = "vertical" +} diff --git a/Sources/ModelsSTU3/CodeSystemClaimPayeeResourceType.swift b/Sources/ModelsSTU3/CodeSystemClaimPayeeResourceType.swift new file mode 100644 index 0000000..aa4efbb --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemClaimPayeeResourceType.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of Claim payee Resource + + URL: http://hl7.org/fhir/ex-payee-resource-type + ValueSet: http://hl7.org/fhir/ValueSet/ex-payee-resource-type + */ +public enum ClaimPayeeResourceType: String, FHIRPrimitiveType { + + /// Organization resource + case organization = "organization" + + /// Patient resource + case patient = "patient" + + /// Practitioner resource + case practitioner = "practitioner" + + /// RelatedPerson resource + case relatedperson = "relatedperson" +} diff --git a/Sources/ModelsSTU3/CodeSystemClassificationOrContext.swift b/Sources/ModelsSTU3/CodeSystemClassificationOrContext.swift new file mode 100644 index 0000000..d706096 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemClassificationOrContext.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Identifies whether a useContext represents a context or classification for the element + + URL: http://hl7.org/fhir/classification-or-context + ValueSet: http://hl7.org/fhir/ValueSet/classification-or-context + */ +public enum ClassificationOrContext: String, FHIRPrimitiveType { + + /// Indicates the useContext is a classification - e.g. Administrative, financial, etc. + case classification = "classification" + + /// Indicates the useContext is a context - a domain of use - e.g. Particular country, organization or system + case context = "context" +} diff --git a/Sources/ModelsSTU3/CodeSystemClinicalImpressionStatus.swift b/Sources/ModelsSTU3/CodeSystemClinicalImpressionStatus.swift new file mode 100644 index 0000000..370647b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemClinicalImpressionStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The workflow state of a clinical impression. + + URL: http://hl7.org/fhir/clinical-impression-status + ValueSet: http://hl7.org/fhir/ValueSet/clinical-impression-status + */ +public enum ClinicalImpressionStatus: String, FHIRPrimitiveType { + + /// The assessment is still on-going and results are not yet final. + case draft = "draft" + + /// The assessment is done and the results are final. + case completed = "completed" + + /// This assessment was never actually done and the record is erroneous (e.g. Wrong patient). + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemCodeSystemContentMode.swift b/Sources/ModelsSTU3/CodeSystemCodeSystemContentMode.swift new file mode 100644 index 0000000..216435d --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCodeSystemContentMode.swift @@ -0,0 +1,42 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How much of the content of the code system - the concepts and codes it defines - are represented in a code system + resource + + URL: http://hl7.org/fhir/codesystem-content-mode + ValueSet: http://hl7.org/fhir/ValueSet/codesystem-content-mode + */ +public enum CodeSystemContentMode: String, FHIRPrimitiveType { + + /// None of the concepts defined by the code system are included in the code system resource + case notPresent = "not-present" + + /// A few representative concepts are included in the code system resource + case example = "example" + + /// A subset of the code system concepts are included in the code system resource + case fragment = "fragment" + + /// All the concepts defined by the code system are included in the code system resource + case complete = "complete" +} diff --git a/Sources/ModelsSTU3/CodeSystemCodeSystemHierarchyMeaning.swift b/Sources/ModelsSTU3/CodeSystemCodeSystemHierarchyMeaning.swift new file mode 100644 index 0000000..171650b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCodeSystemHierarchyMeaning.swift @@ -0,0 +1,46 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The meaning of the hierarchy of concepts in a code system + + URL: http://hl7.org/fhir/codesystem-hierarchy-meaning + ValueSet: http://hl7.org/fhir/ValueSet/codesystem-hierarchy-meaning + */ +public enum CodeSystemHierarchyMeaning: String, FHIRPrimitiveType { + + /// No particular relationship between the concepts can be assumed, except what can be determined by inspection of + /// the definitions of the elements (possible reasons to use this: importing from a source where this is not + /// defined, or where various parts of the hierarchy have different meanings) + case groupedBy = "grouped-by" + + /// A hierarchy where the child concepts have an IS-A relationship with the parents - that is, all the properties of + /// the parent are also true for its child concepts + case isA = "is-a" + + /// Child elements list the individual parts of a composite whole (e.g. body site) + case partOf = "part-of" + + /// Child concepts in the hierarchy may have only one parent, and there is a presumption that the code system is a + /// "closed world" meaning all things must be in the hierarchy. This results in concepts such as "not otherwise + /// classified." + case classifiedWith = "classified-with" +} diff --git a/Sources/ModelsSTU3/CodeSystemCommunicationCategory.swift b/Sources/ModelsSTU3/CodeSystemCommunicationCategory.swift new file mode 100644 index 0000000..30e868b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCommunicationCategory.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes for general categories of communications such as alerts, instruction, etc. + + URL: http://hl7.org/fhir/communication-category + ValueSet: http://hl7.org/fhir/ValueSet/communication-category + */ +public enum CommunicationCategory: String, FHIRPrimitiveType { + + /// The communication conveys an alert. + case alert = "alert" + + /// The communication conveys a notification. + case notification = "notification" + + /// The communication conveys a reminder. + case reminder = "reminder" + + /// The communication conveys instruction. + case instruction = "instruction" +} diff --git a/Sources/ModelsSTU3/CodeSystemCommunicationNotDoneReason.swift b/Sources/ModelsSTU3/CodeSystemCommunicationNotDoneReason.swift new file mode 100644 index 0000000..374421c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCommunicationNotDoneReason.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes for the reason why a communication was not done. + + URL: http://hl7.org/fhir/communication-not-done-reason + ValueSet: http://hl7.org/fhir/ValueSet/communication-not-done-reason + */ +public enum CommunicationNotDoneReason: String, FHIRPrimitiveType { + + /// The communication was not done due to an unknown reason. + case unknown = "unknown" + + /// The communication was not done due to a system error. + case systemError = "system-error" + + /// The communication was not done due to an invalid phone number. + case invalidPhoneNumber = "invalid-phone-number" + + /// The communication was not done due to the recipient being unavailable. + case recipientUnavailable = "recipient-unavailable" + + /// The communication was not done due to a family objection. + case familyObjection = "family-objection" + + /// The communication was not done due to a patient objection. + case patientObjection = "patient-objection" +} diff --git a/Sources/ModelsSTU3/CodeSystemCompartmentType.swift b/Sources/ModelsSTU3/CodeSystemCompartmentType.swift new file mode 100644 index 0000000..a8e653c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCompartmentType.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Which compartment a compartment definition describes + + URL: http://hl7.org/fhir/compartment-type + ValueSet: http://hl7.org/fhir/ValueSet/compartment-type + */ +public enum CompartmentType: String, FHIRPrimitiveType { + + /// The compartment definition is for the patient compartment + case patient = "Patient" + + /// The compartment definition is for the encounter compartment + case encounter = "Encounter" + + /// The compartment definition is for the related-person compartment + case relatedPerson = "RelatedPerson" + + /// The compartment definition is for the practitioner compartment + case practitioner = "Practitioner" + + /// The compartment definition is for the device compartment + case device = "Device" +} diff --git a/Sources/ModelsSTU3/CodeSystemCompositeMeasureScoring.swift b/Sources/ModelsSTU3/CodeSystemCompositeMeasureScoring.swift new file mode 100644 index 0000000..adf1245 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCompositeMeasureScoring.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The composite scoring method of the measure + + URL: http://hl7.org/fhir/composite-measure-scoring + ValueSet: http://hl7.org/fhir/ValueSet/composite-measure-scoring + */ +public enum CompositeMeasureScoring: String, FHIRPrimitiveType { + + /// Opportunity scoring combines the scores from component measures by combining the numerators and denominators for + /// each component + case opportunity = "opportunity" + + /// All-or-nothing scoring includes an individual in the numerator of the composite measure if they are in the + /// numerators of all of the component measures in which they are in the denominator + case allOrNothing = "all-or-nothing" + + /// Linear scoring gives an individual a score based on the number of numerators in which they appear + case linear = "linear" + + /// Weighted scoring gives an individual a score based on a weighted factor for each component numerator in which + /// they appear + case weighted = "weighted" +} diff --git a/Sources/ModelsSTU3/CodeSystemCompositionAttestationMode.swift b/Sources/ModelsSTU3/CodeSystemCompositionAttestationMode.swift new file mode 100644 index 0000000..3db7aa5 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCompositionAttestationMode.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The way in which a person authenticated a composition. + + URL: http://hl7.org/fhir/composition-attestation-mode + ValueSet: http://hl7.org/fhir/ValueSet/composition-attestation-mode + */ +public enum CompositionAttestationMode: String, FHIRPrimitiveType { + + /// The person authenticated the content in their personal capacity. + case personal = "personal" + + /// The person authenticated the content in their professional capacity. + case professional = "professional" + + /// The person authenticated the content and accepted legal responsibility for its content. + case legal = "legal" + + /// The organization authenticated the content as consistent with their policies and procedures. + case official = "official" +} diff --git a/Sources/ModelsSTU3/CodeSystemCompositionStatus.swift b/Sources/ModelsSTU3/CodeSystemCompositionStatus.swift new file mode 100644 index 0000000..c6d3df2 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCompositionStatus.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The workflow/clinical status of the composition. + + URL: http://hl7.org/fhir/composition-status + ValueSet: http://hl7.org/fhir/ValueSet/composition-status + */ +public enum CompositionStatus: String, FHIRPrimitiveType { + + /// This is a preliminary composition or document (also known as initial or interim). The content may be incomplete + /// or unverified. + case preliminary = "preliminary" + + /// This version of the composition is complete and verified by an appropriate person and no further work is + /// planned. Any subsequent updates would be on a new version of the composition. + case final = "final" + + /// The composition content or the referenced resources have been modified (edited or added to) subsequent to being + /// released as "final" and the composition is complete and verified by an authorized person. + case amended = "amended" + + /// The composition or document was originally created/issued in error, and this is an amendment that marks that the + /// entire series should not be considered as valid. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemConceptMapEquivalence.swift b/Sources/ModelsSTU3/CodeSystemConceptMapEquivalence.swift new file mode 100644 index 0000000..829fddb --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConceptMapEquivalence.swift @@ -0,0 +1,67 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The degree of equivalence between concepts. + + URL: http://hl7.org/fhir/concept-map-equivalence + ValueSet: http://hl7.org/fhir/ValueSet/concept-map-equivalence + */ +public enum ConceptMapEquivalence: String, FHIRPrimitiveType { + + /// The concepts are related to each other, and have at least some overlap in meaning, but the exact relationship is + /// not known + case relatedto = "relatedto" + + /// The definitions of the concepts mean the same thing (including when structural implications of meaning are + /// considered) (i.e. extensionally identical). + case equivalent = "equivalent" + + /// The definitions of the concepts are exactly the same (i.e. only grammatical differences) and structural + /// implications of meaning are identical or irrelevant (i.e. intentionally identical). + case equal = "equal" + + /// The target mapping is wider in meaning than the source concept. + case wider = "wider" + + /// The target mapping subsumes the meaning of the source concept (e.g. the source is-a target). + case subsumes = "subsumes" + + /// The target mapping is narrower in meaning than the source concept. The sense in which the mapping is narrower + /// SHALL be described in the comments in this case, and applications should be careful when attempting to use these + /// mappings operationally. + case narrower = "narrower" + + /// The target mapping specializes the meaning of the source concept (e.g. the target is-a source). + case specializes = "specializes" + + /// The target mapping overlaps with the source concept, but both source and target cover additional meaning, or the + /// definitions are imprecise and it is uncertain whether they have the same boundaries to their meaning. The sense + /// in which the mapping is narrower SHALL be described in the comments in this case, and applications should be + /// careful when attempting to use these mappings operationally. + case inexact = "inexact" + + /// There is no match for this concept in the destination concept system. + case unmatched = "unmatched" + + /// This is an explicit assertion that there is no mapping between the source and target concept. + case disjoint = "disjoint" +} diff --git a/Sources/ModelsSTU3/CodeSystemConceptMapGroupUnmappedMode.swift b/Sources/ModelsSTU3/CodeSystemConceptMapGroupUnmappedMode.swift new file mode 100644 index 0000000..dd95750 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConceptMapGroupUnmappedMode.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines which action to take if there is no match in the group. + + URL: http://hl7.org/fhir/conceptmap-unmapped-mode + ValueSet: http://hl7.org/fhir/ValueSet/conceptmap-unmapped-mode + */ +public enum ConceptMapGroupUnmappedMode: String, FHIRPrimitiveType { + + /// Use the code as provided in the $translate request + case provided = "provided" + + /// Use the code explicitly provided in the group.unmapped + case fixed = "fixed" + + /// Use the map identified by the canonical URL in URL + case otherMap = "other-map" +} diff --git a/Sources/ModelsSTU3/CodeSystemConditionState.swift b/Sources/ModelsSTU3/CodeSystemConditionState.swift new file mode 100644 index 0000000..3b90a22 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConditionState.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Enumeration indicating whether the condition is currently active, inactive, or has been resolved. + + URL: http://hl7.org/fhir/condition-state + ValueSet: http://hl7.org/fhir/ValueSet/condition-state + */ +public enum ConditionState: String, FHIRPrimitiveType { + + /// The condition is active. + case active = "active" + + /// The condition is inactive, but not resolved. + case inactive = "inactive" + + /// The condition is resolved. + case resolved = "resolved" +} diff --git a/Sources/ModelsSTU3/CodeSystemConditionVerificationStatus.swift b/Sources/ModelsSTU3/CodeSystemConditionVerificationStatus.swift new file mode 100644 index 0000000..e95d26d --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConditionVerificationStatus.swift @@ -0,0 +1,49 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The verification status to support or decline the clinical status of the condition or diagnosis. + + URL: http://hl7.org/fhir/condition-ver-status + ValueSet: http://hl7.org/fhir/ValueSet/condition-ver-status + */ +public enum ConditionVerificationStatus: String, FHIRPrimitiveType { + + /// This is a tentative diagnosis - still a candidate that is under consideration. + case provisional = "provisional" + + /// One of a set of potential (and typically mutually exclusive) diagnoses asserted to further guide the diagnostic + /// process and preliminary treatment. + case differential = "differential" + + /// There is sufficient diagnostic and/or clinical evidence to treat this as a confirmed condition. + case confirmed = "confirmed" + + /// This condition has been ruled out by diagnostic and clinical evidence. + case refuted = "refuted" + + /// The statement was entered in error and is not valid. + case enteredInError = "entered-in-error" + + /// The condition status is unknown. Note that "unknown" is a value of last resort and every attempt should be made + /// to provide a meaningful value other than "unknown". + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemConditionalDeleteStatus.swift b/Sources/ModelsSTU3/CodeSystemConditionalDeleteStatus.swift new file mode 100644 index 0000000..e74a8c4 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConditionalDeleteStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code that indicates how the server supports conditional delete. + + URL: http://hl7.org/fhir/conditional-delete-status + ValueSet: http://hl7.org/fhir/ValueSet/conditional-delete-status + */ +public enum ConditionalDeleteStatus: String, FHIRPrimitiveType { + + /// No support for conditional deletes. + case notSupported = "not-supported" + + /// Conditional deletes are supported, but only single resources at a time. + case single = "single" + + /// Conditional deletes are supported, and multiple resources can be deleted in a single interaction. + case multiple = "multiple" +} diff --git a/Sources/ModelsSTU3/CodeSystemConditionalReadStatus.swift b/Sources/ModelsSTU3/CodeSystemConditionalReadStatus.swift new file mode 100644 index 0000000..46f6e8a --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConditionalReadStatus.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code that indicates how the server supports conditional read. + + URL: http://hl7.org/fhir/conditional-read-status + ValueSet: http://hl7.org/fhir/ValueSet/conditional-read-status + */ +public enum ConditionalReadStatus: String, FHIRPrimitiveType { + + /// No support for conditional deletes. + case notSupported = "not-supported" + + /// Conditional reads are supported, but only with the If-Modified-Since HTTP Header. + case modifiedSince = "modified-since" + + /// Conditional reads are supported, but only with the If-None-Match HTTP Header. + case notMatch = "not-match" + + /// Conditional reads are supported, with both If-Modified-Since and If-None-Match HTTP Headers. + case fullSupport = "full-support" +} diff --git a/Sources/ModelsSTU3/CodeSystemConformanceExpectation.swift b/Sources/ModelsSTU3/CodeSystemConformanceExpectation.swift new file mode 100644 index 0000000..5a24f83 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConformanceExpectation.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates the degree of adherence to a specified behavior or capability expected for a system to be deemed conformant + with a specification. + + URL: http://hl7.org/fhir/conformance-expectation + ValueSet: http://hl7.org/fhir/ValueSet/conformance-expectation + */ +public enum ConformanceExpectation: String, FHIRPrimitiveType { + + /// Support for the specified capability is required to be considered conformant. + case SHALL = "SHALL" + + /// Support for the specified capability is strongly encouraged, and failure to support it should only occur after + /// careful consideration. + case SHOULD = "SHOULD" + + /// Support for the specified capability is not necessary to be considered conformant, and the requirement should be + /// considered strictly optional. + case MAY = "MAY" + + /// Support for the specified capability is strongly discouraged and should occur only after careful consideration. + case SHOULDNOT = "SHOULD-NOT" +} diff --git a/Sources/ModelsSTU3/CodeSystemConsentDataMeaning.swift b/Sources/ModelsSTU3/CodeSystemConsentDataMeaning.swift new file mode 100644 index 0000000..fce2d8c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConsentDataMeaning.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How a resource reference is interpreted when testing consent restrictions + + URL: http://hl7.org/fhir/consent-data-meaning + ValueSet: http://hl7.org/fhir/ValueSet/consent-data-meaning + */ +public enum ConsentDataMeaning: String, FHIRPrimitiveType { + + /// The consent applies directly to the instance of the resource + case instance = "instance" + + /// The consent applies directly to the instance of the resource and instances it refers to + case related = "related" + + /// The consent applies directly to the instance of the resource and instances that refer to it + case dependents = "dependents" + + /// The consent applies to instances of resources that are authored by + case authoredby = "authoredby" +} diff --git a/Sources/ModelsSTU3/CodeSystemConsentExceptType.swift b/Sources/ModelsSTU3/CodeSystemConsentExceptType.swift new file mode 100644 index 0000000..15b4f06 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConsentExceptType.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How an exception statement is applied, such as adding additional consent or removing consent + + URL: http://hl7.org/fhir/consent-except-type + ValueSet: http://hl7.org/fhir/ValueSet/consent-except-type + */ +public enum ConsentExceptType: String, FHIRPrimitiveType { + + /// Consent is denied for actions meeting these rules + case deny = "deny" + + /// Consent is provided for actions meeting these rules + case permit = "permit" +} diff --git a/Sources/ModelsSTU3/CodeSystemConsentState.swift b/Sources/ModelsSTU3/CodeSystemConsentState.swift new file mode 100644 index 0000000..3a7edf1 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConsentState.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates the state of the consent + + URL: http://hl7.org/fhir/consent-state-codes + ValueSet: http://hl7.org/fhir/ValueSet/consent-state-codes + */ +public enum ConsentState: String, FHIRPrimitiveType { + + /// The consent is in development or awaiting use but is not yet intended to be acted upon. + case draft = "draft" + + /// The consent has been proposed but not yet agreed to by all parties. The negotiation stage. + case proposed = "proposed" + + /// The consent is to be followed and enforced. + case active = "active" + + /// The consent has been rejected by one or more of the parties. + case rejected = "rejected" + + /// The consent is terminated or replaced. + case inactive = "inactive" + + /// The consent was created wrongly (e.g. wrong patient) and should be ignored + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemConstraintSeverity.swift b/Sources/ModelsSTU3/CodeSystemConstraintSeverity.swift new file mode 100644 index 0000000..3431931 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemConstraintSeverity.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + SHALL applications comply with this constraint? + + URL: http://hl7.org/fhir/constraint-severity + ValueSet: http://hl7.org/fhir/ValueSet/constraint-severity + */ +public enum ConstraintSeverity: String, FHIRPrimitiveType { + + /// If the constraint is violated, the resource is not conformant. + case error = "error" + + /// If the constraint is violated, the resource is conformant, but it is not necessarily following best practice. + case warning = "warning" +} diff --git a/Sources/ModelsSTU3/CodeSystemContactPointSystem.swift b/Sources/ModelsSTU3/CodeSystemContactPointSystem.swift new file mode 100644 index 0000000..f297913 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemContactPointSystem.swift @@ -0,0 +1,55 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Telecommunications form for contact point + + URL: http://hl7.org/fhir/contact-point-system + ValueSet: http://hl7.org/fhir/ValueSet/contact-point-system + */ +public enum ContactPointSystem: String, FHIRPrimitiveType { + + /// The value is a telephone number used for voice calls. Use of full international numbers starting with + is + /// recommended to enable automatic dialing support but not required. + case phone = "phone" + + /// The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic + /// dialing support but not required. + case fax = "fax" + + /// The value is an email address. + case email = "email" + + /// The value is a pager number. These may be local pager numbers that are only usable on a particular pager system. + case pager = "pager" + + /// A contact that is not a phone, fax, pager or email address and is expressed as a URL. This is intended for + /// various personal contacts including blogs, Skype, Twitter, Facebook, etc. Do not use for email addresses. + case url = "url" + + /// A contact that can be used for sending an sms message (e.g. mobide phones, some landlines) + case sms = "sms" + + /// A contact that is not a phone, fax, page or email address and is not expressible as a URL. E.g. Internal mail + /// address. This SHOULD NOT be used for contacts that are expressible as a URL (e.g. Skype, Twitter, Facebook, + /// etc.) Extensions may be used to distinguish "other" contact types. + case other = "other" +} diff --git a/Sources/ModelsSTU3/CodeSystemContactPointUse.swift b/Sources/ModelsSTU3/CodeSystemContactPointUse.swift new file mode 100644 index 0000000..bce0f45 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemContactPointUse.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Use of contact point + + URL: http://hl7.org/fhir/contact-point-use + ValueSet: http://hl7.org/fhir/ValueSet/contact-point-use + */ +public enum ContactPointUse: String, FHIRPrimitiveType { + + /// A communication contact point at a home; attempted contacts for business purposes might intrude privacy and + /// chances are one will contact family or other household members instead of the person one wishes to call. + /// Typically used with urgent cases, or if no other contacts are available. + case home = "home" + + /// An office contact point. First choice for business related contacts during business hours. + case work = "work" + + /// A temporary contact point. The period can provide more detailed information. + case temp = "temp" + + /// This contact point is no longer in use (or was never correct, but retained for records). + case old = "old" + + /// A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, + /// suitable for urgent matters, not the first choice for routine business. + case mobile = "mobile" +} diff --git a/Sources/ModelsSTU3/CodeSystemContentType.swift b/Sources/ModelsSTU3/CodeSystemContentType.swift new file mode 100644 index 0000000..c17bb43 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemContentType.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The content or mime type. + + URL: http://hl7.org/fhir/content-type + ValueSet: http://hl7.org/fhir/ValueSet/content-type + */ +public enum ContentType: String, FHIRPrimitiveType { + + /// XML content-type corresponding to the application/fhir+xml mime-type. + case xml = "xml" + + /// JSON content-type corresponding to the application/fhir+json mime-type. + case json = "json" + + /// RDF content-type corresponding to the text/turtle mime-type. + case ttl = "ttl" + + /// Prevent the use of the corresponding http header. + case none = "none" +} diff --git a/Sources/ModelsSTU3/CodeSystemContributorType.swift b/Sources/ModelsSTU3/CodeSystemContributorType.swift new file mode 100644 index 0000000..364b250 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemContributorType.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of contributor + + URL: http://hl7.org/fhir/contributor-type + ValueSet: http://hl7.org/fhir/ValueSet/contributor-type + */ +public enum ContributorType: String, FHIRPrimitiveType { + + /// An author of the content of the module + case author = "author" + + /// An editor of the content of the module + case editor = "editor" + + /// A reviewer of the content of the module + case reviewer = "reviewer" + + /// An endorser of the content of the module + case endorser = "endorser" +} diff --git a/Sources/ModelsSTU3/CodeSystemCopyNumberEvent.swift b/Sources/ModelsSTU3/CodeSystemCopyNumberEvent.swift new file mode 100644 index 0000000..c13d21b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemCopyNumberEvent.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Copy Number Event + + URL: http://hl7.org/fhir/copy-number-event + ValueSet: http://hl7.org/fhir/ValueSet/copy-number-event + */ +public enum CopyNumberEvent: String, FHIRPrimitiveType { + + /// amplificaiton + case amp = "amp" + + /// deletion + case del = "del" + + /// loss of function + case lof = "lof" +} diff --git a/Sources/ModelsSTU3/CodeSystemDataAbsentReason.swift b/Sources/ModelsSTU3/CodeSystemDataAbsentReason.swift new file mode 100644 index 0000000..5968295 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDataAbsentReason.swift @@ -0,0 +1,59 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Used to specify why the normally expected content of the data element is missing. + + URL: http://hl7.org/fhir/data-absent-reason + ValueSet: http://hl7.org/fhir/ValueSet/data-absent-reason + */ +public enum DataAbsentReason: String, FHIRPrimitiveType { + + /// The value is not known. + case unknown = "unknown" + + /// The source human does not know the value. + case asked = "asked" + + /// There is reason to expect (from the workflow) that the value may become known. + case temp = "temp" + + /// The workflow didn't lead to this value being known. + case notAsked = "not-asked" + + /// The information is not available due to security, privacy or related reasons. + case masked = "masked" + + /// The source system wasn't capable of supporting this element. + case unsupported = "unsupported" + + /// The content of the data is represented in the resource narrative. + case astext = "astext" + + /// Some system or workflow process error means that the information is not available. + case error = "error" + + /// NaN, standing for not a number, is a numeric data type value representing an undefined or unrepresentable value. + case naN = "NaN" + + /// The value is not available because the observation procedure (test, etc.) was not performed. + case notPerformed = "not-performed" +} diff --git a/Sources/ModelsSTU3/CodeSystemDataElementStringency.swift b/Sources/ModelsSTU3/CodeSystemDataElementStringency.swift new file mode 100644 index 0000000..16f5171 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDataElementStringency.swift @@ -0,0 +1,54 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates the degree of precision of the data element definition. + + URL: http://hl7.org/fhir/dataelement-stringency + ValueSet: http://hl7.org/fhir/ValueSet/dataelement-stringency + */ +public enum DataElementStringency: String, FHIRPrimitiveType { + + /// The data element is sufficiently well-constrained that multiple pieces of data captured according to the + /// constraints of the data element will be comparable (though in some cases, a degree of automated + /// conversion/normalization may be required). + case comparable = "comparable" + + /// The data element is fully specified down to a single value set, single unit of measure, single data type, etc. + /// Multiple pieces of data associated with this data element are fully comparable. + case fullySpecified = "fully-specified" + + /// The data element allows multiple units of measure having equivalent meaning; e.g. "cc" (cubic centimeter) and + /// "mL" (milliliter). + case equivalent = "equivalent" + + /// The data element allows multiple units of measure that are convertable between each other (e.g. inches and + /// centimeters) and/or allows data to be captured in multiple value sets for which a known mapping exists allowing + /// conversion of meaning. + case convertable = "convertable" + + /// A convertable data element where unit conversions are different only by a power of 10; e.g. g, mg, kg. + case scaleable = "scaleable" + + /// The data element is unconstrained in units, choice of data types and/or choice of vocabulary such that automated + /// comparison of data captured using the data element is not possible. + case flexible = "flexible" +} diff --git a/Sources/ModelsSTU3/CodeSystemDataType.swift b/Sources/ModelsSTU3/CodeSystemDataType.swift new file mode 100644 index 0000000..83d4328 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDataType.swift @@ -0,0 +1,215 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of an element - one of the FHIR data types. + + URL: http://hl7.org/fhir/data-types + ValueSet: http://hl7.org/fhir/ValueSet/data-types + */ +public enum DataType: String, FHIRPrimitiveType { + + /// An address expressed using postal conventions (as opposed to GPS or other location definition formats). This + /// data type may be used to convey addresses for use in delivering mail as well as for visiting locations which + /// might not be valid for mail delivery. There are a variety of postal address formats defined around the world. + case address = "Address" + + /// A duration of time during which an organism (or a process) has existed. + case age = "Age" + + /// A text note which also contains information about who made the statement and when. + case annotation = "Annotation" + + /// For referring to data content defined in other formats. + case attachment = "Attachment" + + /// Base definition for all elements that are defined inside a resource - but not those in a data type. + case backboneElement = "BackboneElement" + + /// A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text. + case codeableConcept = "CodeableConcept" + + /// A reference to a code defined by a terminology system. + case coding = "Coding" + + /// Specifies contact information for a person or organization. + case contactDetail = "ContactDetail" + + /// Details for all kinds of technology mediated contact points for a person or organization, including telephone, + /// email, etc. + case contactPoint = "ContactPoint" + + /// A contributor to the content of a knowledge asset, including authors, editors, reviewers, and endorsers. + case contributor = "Contributor" + + /// A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts + /// that are not precisely quantified, including amounts involving arbitrary units and floating currencies. + case count = "Count" + + /// Describes a required data item for evaluation in terms of the type of data, and optional code or date-based + /// filters of the data. + case dataRequirement = "DataRequirement" + + /// A length - a value with a unit that is a physical distance. + case distance = "Distance" + + /// Indicates how the medication is/was taken or should be taken by the patient. + case dosage = "Dosage" + + /// A length of time. + case duration = "Duration" + + /// Base definition for all elements in a resource. + case element = "Element" + + /// Captures constraints on each element within the resource, profile, or extension. + case elementDefinition = "ElementDefinition" + + /// Optional Extension Element - found in all resources. + case `extension` = "Extension" + + /// A human's name with the ability to identify parts and usage. + case humanName = "HumanName" + + /// A technical identifier - identifies some entity uniquely and unambiguously. + case identifier = "Identifier" + + /// The metadata about a resource. This is content in the resource that is maintained by the infrastructure. Changes + /// to the content may not always be associated with version changes to the resource. + case meta = "Meta" + + /// An amount of economic utility in some recognized currency. + case money = "Money" + + /// A human-readable formatted text, including images. + case narrative = "Narrative" + + /// The parameters to the module. This collection specifies both the input and output parameters. Input parameters + /// are provided by the caller as part of the $evaluate operation. Output parameters are included in the + /// GuidanceResponse. + case parameterDefinition = "ParameterDefinition" + + /// A time period defined by a start and end date and optionally time. + case period = "Period" + + /// A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts + /// that are not precisely quantified, including amounts involving arbitrary units and floating currencies. + case quantity = "Quantity" + + /// A set of ordered Quantities defined by a low and high limit. + case range = "Range" + + /// A relationship of two Quantity values - expressed as a numerator and a denominator. + case ratio = "Ratio" + + /// A reference from one resource to another. + case reference = "Reference" + + /// Related artifacts such as additional documentation, justification, or bibliographic references. + case relatedArtifact = "RelatedArtifact" + + /// A series of measurements taken by a device, with upper and lower limits. There may be more than one dimension in + /// the data. + case sampledData = "SampledData" + + /// A digital signature along with supporting context. The signature may be electronic/cryptographic in nature, or a + /// graphical image representing a hand-written signature, or a signature process. Different signature approaches + /// have different utilities. + case signature = "Signature" + + /// simpleQuantity + case simpleQuantity = "SimpleQuantity" + + /// Specifies an event that may occur multiple times. Timing schedules are used to record when things are planned, + /// expected or requested to occur. The most common usage is in dosage instructions for medications. They are also + /// used when planning care of various kinds, and may be used for reporting the schedule to which past regular + /// activities were carried out. + case timing = "Timing" + + /// A description of a triggering event. + case triggerDefinition = "TriggerDefinition" + + /// Specifies clinical/business/etc metadata that can be used to retrieve, index and/or categorize an artifact. This + /// metadata can either be specific to the applicable population (e.g., age category, DRG) or the specific context + /// of care (e.g., venue, care setting, provider of care). + case usageContext = "UsageContext" + + /// A stream of bytes + case base64Binary = "base64Binary" + + /// Value of "true" or "false" + case boolean = "boolean" + + /// A string which has at least one character and no leading or trailing whitespace and where there is no whitespace + /// other than single spaces in the contents + case code = "code" + + /// A date or partial date (e.g. just year or year + month). There is no time zone. The format is a union of the + /// schema types gYear, gYearMonth and date. Dates SHALL be valid dates. + case date = "date" + + /// A date, date-time or partial date (e.g. just year or year + month). If hours and minutes are specified, a time + /// zone SHALL be populated. The format is a union of the schema types gYear, gYearMonth, date and dateTime. Seconds + /// must be provided due to schema type constraints but may be zero-filled and may be ignored. Dates + /// SHALL be valid dates. + case dateTime = "dateTime" + + /// A rational number with implicit precision + case decimal = "decimal" + + /// Any combination of letters, numerals, "-" and ".", with a length limit of 64 characters. (This might be an + /// integer, an unprefixed OID, UUID or any other identifier pattern that meets these constraints.) Ids are case- + /// insensitive. + case id = "id" + + /// An instant in time - known at least to the second + case instant = "instant" + + /// A whole number + case integer = "integer" + + /// A string that may contain markdown syntax for optional processing by a mark down presentation engine + case markdown = "markdown" + + /// An OID represented as a URI + case oid = "oid" + + /// An integer with a value that is positive (e.g. >0) + case positiveInt = "positiveInt" + + /// A sequence of Unicode characters + case string = "string" + + /// A time during the day, with no date specified + case time = "time" + + /// An integer with a value that is not negative (e.g. >= 0) + case unsignedInt = "unsignedInt" + + /// String of characters used to identify a name or a resource + case uri = "uri" + + /// A UUID, represented as a URI + case uuid = "uuid" + + /// XHTML format, as defined by W3C, but restricted usage (mainly, no active content) + case xhtml = "xhtml" +} diff --git a/Sources/ModelsSTU3/CodeSystemDaysOfWeek.swift b/Sources/ModelsSTU3/CodeSystemDaysOfWeek.swift new file mode 100644 index 0000000..d8b13a9 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDaysOfWeek.swift @@ -0,0 +1,50 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The days of the week. + + URL: http://hl7.org/fhir/days-of-week + ValueSet: http://hl7.org/fhir/ValueSet/days-of-week + */ +public enum DaysOfWeek: String, FHIRPrimitiveType { + + /// Monday + case mon = "mon" + + /// Tuesday + case tue = "tue" + + /// Wednesday + case wed = "wed" + + /// Thursday + case thu = "thu" + + /// Friday + case fri = "fri" + + /// Saturday + case sat = "sat" + + /// Sunday + case sun = "sun" +} diff --git a/Sources/ModelsSTU3/CodeSystemDefinitionStatus.swift b/Sources/ModelsSTU3/CodeSystemDefinitionStatus.swift new file mode 100644 index 0000000..ea1a874 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDefinitionStatus.swift @@ -0,0 +1,43 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes identifying the lifecycle stage of a definition + + URL: http://hl7.org/fhir/definition-status + ValueSet: http://hl7.org/fhir/ValueSet/definition-status + */ +public enum DefinitionStatus: String, FHIRPrimitiveType { + + /// The definition is in the design stage and is not yet considered to be "ready for use" + case draft = "draft" + + /// The definition is considered ready for use + case active = "active" + + /// The definition should no longer be used + case withdrawn = "withdrawn" + + /// The authoring system does not know which of the status values currently applies for this request. Note: This + /// concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known + /// which one. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemDefinitionTopic.swift b/Sources/ModelsSTU3/CodeSystemDefinitionTopic.swift new file mode 100644 index 0000000..c55f043 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDefinitionTopic.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + High-level categorization of the definition, used for searching, sorting, and filtering + + URL: http://hl7.org/fhir/definition-topic + ValueSet: http://hl7.org/fhir/ValueSet/definition-topic + */ +public enum DefinitionTopic: String, FHIRPrimitiveType { + + /// The definition is related to treatment of the patient + case treatment = "treatment" + + /// The definition is related to education of the patient + case education = "education" + + /// The definition is related to assessment of the patient + case assessment = "assessment" +} diff --git a/Sources/ModelsSTU3/CodeSystemDetectedIssueSeverity.swift b/Sources/ModelsSTU3/CodeSystemDetectedIssueSeverity.swift new file mode 100644 index 0000000..390b58f --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDetectedIssueSeverity.swift @@ -0,0 +1,40 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates the potential degree of impact of the identified issue on the patient. + + URL: http://hl7.org/fhir/detectedissue-severity + ValueSet: http://hl7.org/fhir/ValueSet/detectedissue-severity + */ +public enum DetectedIssueSeverity: String, FHIRPrimitiveType { + + /// Indicates the issue may be life-threatening or has the potential to cause permanent injury. + case high = "high" + + /// Indicates the issue may result in noticeable adverse consequences but is unlikely to be life-threatening or + /// cause permanent injury. + case moderate = "moderate" + + /// Indicates the issue may result in some adverse consequences but is unlikely to substantially affect the + /// situation of the subject. + case low = "low" +} diff --git a/Sources/ModelsSTU3/CodeSystemDeviceComponentOperationalStatus.swift b/Sources/ModelsSTU3/CodeSystemDeviceComponentOperationalStatus.swift new file mode 100644 index 0000000..e0e46fc --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDeviceComponentOperationalStatus.swift @@ -0,0 +1,50 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes representing the current status of the device - on, off, suspended, etc. + + URL: http://hl7.org/fhir/operational-status + ValueSet: http://hl7.org/fhir/ValueSet/operational-status + */ +public enum DeviceComponentOperationalStatus: String, FHIRPrimitiveType { + + /// The device is off. + case off = "off" + + /// The device is fully operational. + case on = "on" + + /// The device is not ready. + case notReady = "not-ready" + + /// The device is ready but not actively operating. + case standby = "standby" + + /// The device transducer is diconnected. + case transducDiscon = "transduc-discon" + + /// The device hardware is disconnected. + case hwDiscon = "hw-discon" + + /// The device was entered in error. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemDeviceComponentParameterGroup.swift b/Sources/ModelsSTU3/CodeSystemDeviceComponentParameterGroup.swift new file mode 100644 index 0000000..280e997 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDeviceComponentParameterGroup.swift @@ -0,0 +1,56 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes identifying groupings of parameters; e.g. Cardiovascular. + + URL: http://hl7.org/fhir/parameter-group + ValueSet: http://hl7.org/fhir/ValueSet/parameter-group + */ +public enum DeviceComponentParameterGroup: String, FHIRPrimitiveType { + + /// Haemodynamic Parameter Group - MDC_PGRP_HEMO + case haemodynamic = "haemodynamic" + + /// ECG Parameter Group - MDC_PGRP_ECG + case ecg = "ecg" + + /// Respiratory Parameter Group - MDC_PGRP_RESP + case respiratory = "respiratory" + + /// Ventilation Parameter Group - MDC_PGRP_VENT + case ventilation = "ventilation" + + /// Neurological Parameter Group - MDC_PGRP_NEURO + case neurological = "neurological" + + /// Drug Delivery Parameter Group - MDC_PGRP_DRUG + case drugDelivery = "drug-delivery" + + /// Fluid Chemistry Parameter Group - MDC_PGRP_FLUID + case fluidChemistry = "fluid-chemistry" + + /// Blood Chemistry Parameter Group - MDC_PGRP_BLOOD_CHEM + case bloodChemistry = "blood-chemistry" + + /// Miscellaneous Parameter Group - MDC_PGRP_MISC + case miscellaneous = "miscellaneous" +} diff --git a/Sources/ModelsSTU3/CodeSystemDeviceMetricCalibrationState.swift b/Sources/ModelsSTU3/CodeSystemDeviceMetricCalibrationState.swift new file mode 100644 index 0000000..d80a2f6 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDeviceMetricCalibrationState.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Describes the state of a metric calibration. + + URL: http://hl7.org/fhir/metric-calibration-state + ValueSet: http://hl7.org/fhir/ValueSet/metric-calibration-state + */ +public enum DeviceMetricCalibrationState: String, FHIRPrimitiveType { + + /// The metric has not been calibrated. + case notCalibrated = "not-calibrated" + + /// The metric needs to be calibrated. + case calibrationRequired = "calibration-required" + + /// The metric has been calibrated. + case calibrated = "calibrated" + + /// The state of calibration of this metric is unspecified. + case unspecified = "unspecified" +} diff --git a/Sources/ModelsSTU3/CodeSystemDeviceMetricCalibrationType.swift b/Sources/ModelsSTU3/CodeSystemDeviceMetricCalibrationType.swift new file mode 100644 index 0000000..b9c5cb7 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDeviceMetricCalibrationType.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Describes the type of a metric calibration. + + URL: http://hl7.org/fhir/metric-calibration-type + ValueSet: http://hl7.org/fhir/ValueSet/metric-calibration-type + */ +public enum DeviceMetricCalibrationType: String, FHIRPrimitiveType { + + /// Metric calibration method has not been identified. + case unspecified = "unspecified" + + /// Offset metric calibration method + case offset = "offset" + + /// Gain metric calibration method + case gain = "gain" + + /// Two-point metric calibration method + case twoPoint = "two-point" +} diff --git a/Sources/ModelsSTU3/CodeSystemDeviceMetricCategory.swift b/Sources/ModelsSTU3/CodeSystemDeviceMetricCategory.swift new file mode 100644 index 0000000..0783b82 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDeviceMetricCategory.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Describes the category of the metric. + + URL: http://hl7.org/fhir/metric-category + ValueSet: http://hl7.org/fhir/ValueSet/metric-category + */ +public enum DeviceMetricCategory: String, FHIRPrimitiveType { + + /// DeviceObservations generated for this DeviceMetric are measured. + case measurement = "measurement" + + /// DeviceObservations generated for this DeviceMetric is a setting that will influence the behavior of the Device. + case setting = "setting" + + /// DeviceObservations generated for this DeviceMetric are calculated. + case calculation = "calculation" + + /// The category of this DeviceMetric is unspecified. + case unspecified = "unspecified" +} diff --git a/Sources/ModelsSTU3/CodeSystemDeviceMetricColor.swift b/Sources/ModelsSTU3/CodeSystemDeviceMetricColor.swift new file mode 100644 index 0000000..5ae75df --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDeviceMetricColor.swift @@ -0,0 +1,53 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Describes the typical color of representation. + + URL: http://hl7.org/fhir/metric-color + ValueSet: http://hl7.org/fhir/ValueSet/metric-color + */ +public enum DeviceMetricColor: String, FHIRPrimitiveType { + + /// Color for representation - black. + case black = "black" + + /// Color for representation - red. + case red = "red" + + /// Color for representation - green. + case green = "green" + + /// Color for representation - yellow. + case yellow = "yellow" + + /// Color for representation - blue. + case blue = "blue" + + /// Color for representation - magenta. + case magenta = "magenta" + + /// Color for representation - cyan. + case cyan = "cyan" + + /// Color for representation - white. + case white = "white" +} diff --git a/Sources/ModelsSTU3/CodeSystemDeviceMetricOperationalStatus.swift b/Sources/ModelsSTU3/CodeSystemDeviceMetricOperationalStatus.swift new file mode 100644 index 0000000..89e9246 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDeviceMetricOperationalStatus.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Describes the operational status of the DeviceMetric. + + URL: http://hl7.org/fhir/metric-operational-status + ValueSet: http://hl7.org/fhir/ValueSet/metric-operational-status + */ +public enum DeviceMetricOperationalStatus: String, FHIRPrimitiveType { + + /// The DeviceMetric is operating and will generate DeviceObservations. + case on = "on" + + /// The DeviceMetric is not operating. + case off = "off" + + /// The DeviceMetric is operating, but will not generate any DeviceObservations. + case standby = "standby" + + /// The DeviceMetric was entered in error. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemDeviceSpecificationSpecType.swift b/Sources/ModelsSTU3/CodeSystemDeviceSpecificationSpecType.swift new file mode 100644 index 0000000..760bee3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDeviceSpecificationSpecType.swift @@ -0,0 +1,53 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes for device specification types such as serial number, part number, hardware revision, software revision, etc. + + URL: http://hl7.org/fhir/specification-type + ValueSet: http://hl7.org/fhir/ValueSet/specification-type + */ +public enum DeviceSpecificationSpecType: String, FHIRPrimitiveType { + + /// Unspecified Production Specification - MDC_ID_PROD_SPEC_UNSPECIFIED + case unspecified = "unspecified" + + /// Serial Number - MDC_ID_PROD_SPEC_SERIAL + case serialNumber = "serial-number" + + /// Part Number - MDC_ID_PROD_SPEC_PART + case partNumber = "part-number" + + /// Hardware Revision - MDC_ID_PROD_SPEC_HW + case hardwareRevision = "hardware-revision" + + /// Software Revision - MDC_ID_PROD_SPEC_SW + case softwareRevision = "software-revision" + + /// Firmware Revision - MDC_ID_PROD_SPEC_FW + case firmwareRevision = "firmware-revision" + + /// Protocol Revision - MDC_ID_PROD_SPEC_PROTOCOL + case protocolRevision = "protocol-revision" + + /// GMDN - MDC_ID_PROD_SPEC_GMDN + case gmdn = "gmdn" +} diff --git a/Sources/ModelsSTU3/CodeSystemDeviceUseStatementStatus.swift b/Sources/ModelsSTU3/CodeSystemDeviceUseStatementStatus.swift new file mode 100644 index 0000000..8807598 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDeviceUseStatementStatus.swift @@ -0,0 +1,48 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept indicating the current status of a the Device Usage + + URL: http://hl7.org/fhir/device-statement-status + ValueSet: http://hl7.org/fhir/ValueSet/device-statement-status + */ +public enum DeviceUseStatementStatus: String, FHIRPrimitiveType { + + /// The device is still being used. + case active = "active" + + /// The device is no longer being used. + case completed = "completed" + + /// The statement was recorded incorrectly. + case enteredInError = "entered-in-error" + + /// The device may be used at some time in the future. + case intended = "intended" + + /// Actions implied by the statement have been permanently halted, before all of them occurred. + case stopped = "stopped" + + /// Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be + /// called "suspended". + case onHold = "on-hold" +} diff --git a/Sources/ModelsSTU3/CodeSystemDiagnosticReportStatus.swift b/Sources/ModelsSTU3/CodeSystemDiagnosticReportStatus.swift new file mode 100644 index 0000000..fbdfdb4 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDiagnosticReportStatus.swift @@ -0,0 +1,68 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The status of the diagnostic report as a whole. + + URL: http://hl7.org/fhir/diagnostic-report-status + ValueSet: http://hl7.org/fhir/ValueSet/diagnostic-report-status + */ +public enum DiagnosticReportStatus: String, FHIRPrimitiveType { + + /// The existence of the report is registered, but there is nothing yet available. + case registered = "registered" + + /// This is a partial (e.g. initial, interim or preliminary) report: data in the report may be incomplete or + /// unverified. + case partial = "partial" + + /// Verified early results are available, but not all results are final. + case preliminary = "preliminary" + + /// The report is complete and verified by an authorized person. + case final = "final" + + /// Subsequent to being final, the report has been modified. This includes any change in the results, diagnosis, + /// narrative text, or other content of a report that has been issued. + case amended = "amended" + + /// Subsequent to being final, the report has been modified to correct an error in the report or referenced + /// results. + case corrected = "corrected" + + /// Subsequent to being final, the report has been modified by adding new content. The existing content is + /// unchanged. + case appended = "appended" + + /// The report is unavailable because the measurement was not started or not completed (also sometimes called + /// "aborted"). + case cancelled = "cancelled" + + /// The report has been withdrawn following a previous final release. This electronic record should never have + /// existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, + /// the status should be "cancelled" rather than "entered-in-error".) + case enteredInError = "entered-in-error" + + /// The authoring system does not know which of the status values currently applies for this request. Note: This + /// concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known + /// which one. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemDigitalMediaType.swift b/Sources/ModelsSTU3/CodeSystemDigitalMediaType.swift new file mode 100644 index 0000000..c9a62d9 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDigitalMediaType.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Whether the media is a photo, video, or audio + + URL: http://hl7.org/fhir/digital-media-type + ValueSet: http://hl7.org/fhir/ValueSet/digital-media-type + */ +public enum DigitalMediaType: String, FHIRPrimitiveType { + + /// The media consists of one or more unmoving images, including photographs, computer-generated graphs and charts, + /// and scanned documents + case photo = "photo" + + /// The media consists of a series of frames that capture a moving image + case video = "video" + + /// The media consists of a sound recording + case audio = "audio" +} diff --git a/Sources/ModelsSTU3/CodeSystemDiscriminatorType.swift b/Sources/ModelsSTU3/CodeSystemDiscriminatorType.swift new file mode 100644 index 0000000..e50b255 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDiscriminatorType.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How an element value is interpreted when discrimination is evaluated + + URL: http://hl7.org/fhir/discriminator-type + ValueSet: http://hl7.org/fhir/ValueSet/discriminator-type + */ +public enum DiscriminatorType: String, FHIRPrimitiveType { + + /// The slices have different values in the nominated element + case value = "value" + + /// The slices are differentiated by the presence or absence of the nominated element + case exists = "exists" + + /// The slices have different values in the nominated element, as determined by testing them against the applicable + /// ElementDefinition.pattern[x] + case pattern = "pattern" + + /// The slices are differentiated by type of the nominated element to a specifed profile + case type = "type" + + /// The slices are differentiated by conformance of the nominated element to a specifed profile + case profile = "profile" +} diff --git a/Sources/ModelsSTU3/CodeSystemDocumentMode.swift b/Sources/ModelsSTU3/CodeSystemDocumentMode.swift new file mode 100644 index 0000000..e8fed57 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDocumentMode.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Whether the application produces or consumes documents. + + URL: http://hl7.org/fhir/document-mode + ValueSet: http://hl7.org/fhir/ValueSet/document-mode + */ +public enum DocumentMode: String, FHIRPrimitiveType { + + /// The application produces documents of the specified type. + case producer = "producer" + + /// The application consumes documents of the specified type. + case consumer = "consumer" +} diff --git a/Sources/ModelsSTU3/CodeSystemDocumentReferenceStatus.swift b/Sources/ModelsSTU3/CodeSystemDocumentReferenceStatus.swift new file mode 100644 index 0000000..a918b5c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDocumentReferenceStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The status of the document reference. + + URL: http://hl7.org/fhir/document-reference-status + ValueSet: http://hl7.org/fhir/ValueSet/document-reference-status + */ +public enum DocumentReferenceStatus: String, FHIRPrimitiveType { + + /// This is the current reference for this document. + case current = "current" + + /// This reference has been superseded by another reference. + case superseded = "superseded" + + /// This reference was created in error. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemDocumentRelationshipType.swift b/Sources/ModelsSTU3/CodeSystemDocumentRelationshipType.swift new file mode 100644 index 0000000..acd5cc3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemDocumentRelationshipType.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of relationship between documents. + + URL: http://hl7.org/fhir/document-relationship-type + ValueSet: http://hl7.org/fhir/ValueSet/document-relationship-type + */ +public enum DocumentRelationshipType: String, FHIRPrimitiveType { + + /// This document logically replaces or supersedes the target document. + case replaces = "replaces" + + /// This document was generated by transforming the target document (e.g. format or language conversion). + case transforms = "transforms" + + /// This document is a signature of the target document. + case signs = "signs" + + /// This document adds additional information to the target document. + case appends = "appends" +} diff --git a/Sources/ModelsSTU3/CodeSystemEncounterLocationStatus.swift b/Sources/ModelsSTU3/CodeSystemEncounterLocationStatus.swift new file mode 100644 index 0000000..10c82c1 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemEncounterLocationStatus.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The status of the location. + + URL: http://hl7.org/fhir/encounter-location-status + ValueSet: http://hl7.org/fhir/ValueSet/encounter-location-status + */ +public enum EncounterLocationStatus: String, FHIRPrimitiveType { + + /// The patient is planned to be moved to this location at some point in the future. + case planned = "planned" + + /// The patient is currently at this location, or was between the period specified. + /// + /// A system may update these records when the patient leaves the location to either reserved, or completed + case active = "active" + + /// This location is held empty for this patient. + case reserved = "reserved" + + /// The patient was at this location during the period specified. + /// + /// Not to be used when the patient is currently at the location + case completed = "completed" +} diff --git a/Sources/ModelsSTU3/CodeSystemEncounterStatus.swift b/Sources/ModelsSTU3/CodeSystemEncounterStatus.swift new file mode 100644 index 0000000..150d1f1 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemEncounterStatus.swift @@ -0,0 +1,57 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Current state of the encounter + + URL: http://hl7.org/fhir/encounter-status + ValueSet: http://hl7.org/fhir/ValueSet/encounter-status + */ +public enum EncounterStatus: String, FHIRPrimitiveType { + + /// The Encounter has not yet started. + case planned = "planned" + + /// The Patient is present for the encounter, however is not currently meeting with a practitioner. + case arrived = "arrived" + + /// The patient has been assessed for the priority of their treatment based on the severity of their condition. + case triaged = "triaged" + + /// The Encounter has begun and the patient is present / the practitioner and the patient are meeting. + case inProgress = "in-progress" + + /// The Encounter has begun, but the patient is temporarily on leave. + case onleave = "onleave" + + /// The Encounter has ended. + case finished = "finished" + + /// The Encounter has ended before it has begun. + case cancelled = "cancelled" + + /// This instance should not have been part of this patient's medical record. + case enteredInError = "entered-in-error" + + /// The encounter status is unknown. Note that "unknown" is a value of last resort and every attempt should be made + /// to provide a meaningful value other than "unknown". + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemEndpointStatus.swift b/Sources/ModelsSTU3/CodeSystemEndpointStatus.swift new file mode 100644 index 0000000..3558c97 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemEndpointStatus.swift @@ -0,0 +1,48 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The status of the endpoint + + URL: http://hl7.org/fhir/endpoint-status + ValueSet: http://hl7.org/fhir/ValueSet/endpoint-status + */ +public enum EndpointStatus: String, FHIRPrimitiveType { + + /// This endpoint is expected to be active and can be used + case active = "active" + + /// This endpoint is temporarily unavailable + case suspended = "suspended" + + /// This endpoint has exceeded connectivity thresholds and is considered in an error state and should no longer be + /// attempted to connect to until corrective action is taken + case error = "error" + + /// This endpoint is no longer to be used + case off = "off" + + /// This instance should not have been part of this patient's medical record. + case enteredInError = "entered-in-error" + + /// This endpoint is not intended for production usage. + case test = "test" +} diff --git a/Sources/ModelsSTU3/CodeSystemEpisodeOfCareStatus.swift b/Sources/ModelsSTU3/CodeSystemEpisodeOfCareStatus.swift new file mode 100644 index 0000000..317a85b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemEpisodeOfCareStatus.swift @@ -0,0 +1,56 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The status of the episode of care. + + URL: http://hl7.org/fhir/episode-of-care-status + ValueSet: http://hl7.org/fhir/ValueSet/episode-of-care-status + */ +public enum EpisodeOfCareStatus: String, FHIRPrimitiveType { + + /// This episode of care is planned to start at the date specified in the period.start. During this status, an + /// organization may perform assessments to determine if the patient is eligible to receive services, or be + /// organizing to make resources available to provide care services. + case planned = "planned" + + /// This episode has been placed on a waitlist, pending the episode being made active (or cancelled). + case waitlist = "waitlist" + + /// This episode of care is current. + case active = "active" + + /// This episode of care is on hold, the organization has limited responsibility for the patient (such as while on + /// respite). + case onhold = "onhold" + + /// This episode of care is finished and the organization is not expecting to be providing further care to the + /// patient. Can also be known as "closed", "completed" or other similar terms. + case finished = "finished" + + /// The episode of care was cancelled, or withdrawn from service, often selected during the planned stage as the + /// patient may have gone elsewhere, or the circumstances have changed and the organization is unable to provide the + /// care. It indicates that services terminated outside the planned/expected workflow. + case cancelled = "cancelled" + + /// This instance should not have been part of this patient's medical record. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemEventCapabilityMode.swift b/Sources/ModelsSTU3/CodeSystemEventCapabilityMode.swift new file mode 100644 index 0000000..d89d651 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemEventCapabilityMode.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The mode of a message capability statement. + + URL: http://hl7.org/fhir/event-capability-mode + ValueSet: http://hl7.org/fhir/ValueSet/event-capability-mode + */ +public enum EventCapabilityMode: String, FHIRPrimitiveType { + + /// The application sends requests and receives responses. + case sender = "sender" + + /// The application receives requests and sends responses. + case receiver = "receiver" +} diff --git a/Sources/ModelsSTU3/CodeSystemEventStatus.swift b/Sources/ModelsSTU3/CodeSystemEventStatus.swift new file mode 100644 index 0000000..0dd8192 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemEventStatus.swift @@ -0,0 +1,54 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes identifying the stage lifecycle stage of a event + + URL: http://hl7.org/fhir/event-status + ValueSet: http://hl7.org/fhir/ValueSet/event-status + */ +public enum EventStatus: String, FHIRPrimitiveType { + + /// The core event has not started yet, but some staging activities have begun (e.g. surgical suite preparation). + /// Preparation stages may be tracked for billing purposes. + case preparation = "preparation" + + /// The event is currently occurring + case inProgress = "in-progress" + + /// The event has been temporarily stopped but is expected to resume in the future + case suspended = "suspended" + + /// The event was prior to the full completion of the intended actions + case aborted = "aborted" + + /// The event has now concluded + case completed = "completed" + + /// This electronic record should never have existed, though it is possible that real-world decisions were based on + /// it. (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".) + case enteredInError = "entered-in-error" + + /// The authoring system does not know which of the status values currently applies for this request. Note: This + /// concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known + /// which one. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemEventTiming.swift b/Sources/ModelsSTU3/CodeSystemEventTiming.swift new file mode 100644 index 0000000..9bf9ef3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemEventTiming.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Real world event relating to the schedule. + + URL: http://hl7.org/fhir/event-timing + ValueSet: http://hl7.org/fhir/ValueSet/event-timing + */ +public enum EventTiming: String, FHIRPrimitiveType { + + /// event occurs during the morning + case MORN = "MORN" + + /// event occurs during the afternoon + case AFT = "AFT" + + /// event occurs during the evening + case EVE = "EVE" + + /// event occurs during the night + case NIGHT = "NIGHT" + + /// event occurs [offset] after subject goes to sleep + case PHS = "PHS" +} diff --git a/Sources/ModelsSTU3/CodeSystemExplanationOfBenefitStatus.swift b/Sources/ModelsSTU3/CodeSystemExplanationOfBenefitStatus.swift new file mode 100644 index 0000000..42765d7 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemExplanationOfBenefitStatus.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code specifying the state of the resource instance. + + URL: http://hl7.org/fhir/explanationofbenefit-status + ValueSet: http://hl7.org/fhir/ValueSet/explanationofbenefit-status + */ +public enum ExplanationOfBenefitStatus: String, FHIRPrimitiveType { + + /// The resource instance is currently in-force. + case active = "active" + + /// The resource instance is withdrawn, rescinded or reversed. + case cancelled = "cancelled" + + /// A new resource instance the contents of which is not complete. + case draft = "draft" + + /// The resource instance was entered in error. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemExtensionContext.swift b/Sources/ModelsSTU3/CodeSystemExtensionContext.swift new file mode 100644 index 0000000..fbe2a36 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemExtensionContext.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How an extension context is interpreted. + + URL: http://hl7.org/fhir/extension-context + ValueSet: http://hl7.org/fhir/ValueSet/extension-context + */ +public enum ExtensionContext: String, FHIRPrimitiveType { + + /// The context is all elements matching a particular resource element path. + case resource = "resource" + + /// The context is all nodes matching a particular data type element path (root or repeating element) or all + /// elements referencing a particular primitive data type (expressed as the datatype name). + case datatype = "datatype" + + /// The context is a particular extension from a particular profile, a uri that identifies the extension definition. + case `extension` = "extension" +} diff --git a/Sources/ModelsSTU3/CodeSystemFHIRDefinedConceptProperties.swift b/Sources/ModelsSTU3/CodeSystemFHIRDefinedConceptProperties.swift new file mode 100644 index 0000000..f3be2aa --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemFHIRDefinedConceptProperties.swift @@ -0,0 +1,51 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A set of common concept properties for use on coded systems through out the FHIR eco-system. + + URL: http://hl7.org/fhir/concept-properties + ValueSet: http://hl7.org/fhir/ValueSet/concept-properties + */ +public enum FHIRDefinedConceptProperties: String, FHIRPrimitiveType { + + /// True if the concept is not considered active - e.g. not a valid concept any more. Property type is boolean, + /// default value is false + case inactive = "inactive" + + /// The date at which a concept was deprecated. Concepts that are deprecated but not inactive can still be used, but + /// their use is discouraged, and they should be expected to be made inactive in a future release. Property type is + /// dateTime + case deprecated = "deprecated" + + /// The concept is not intended to be chosen by the user - only intended to be used as a selector for other + /// concepts. Note, though, that the interpretation of this is highly contextual; all concepts are selectable in + /// some context. Property type is boolean, default value is false + case notSelectable = "notSelectable" + + /// The concept identified in this property is a parent of the concept on which it is a property. The property type + /// will be 'code'. The meaning of 'parent' is defined by the hierarchyMeaning attribute + case parent = "parent" + + /// The concept identified in this property is a child of the concept on which it is a property. The property type + /// will be 'code'. The meaning of 'child' is defined by the hierarchyMeaning attribute + case child = "child" +} diff --git a/Sources/ModelsSTU3/CodeSystemFHIRDeviceStatus.swift b/Sources/ModelsSTU3/CodeSystemFHIRDeviceStatus.swift new file mode 100644 index 0000000..6730d85 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemFHIRDeviceStatus.swift @@ -0,0 +1,43 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The availability status of the device. + + URL: http://hl7.org/fhir/device-status + ValueSet: http://hl7.org/fhir/ValueSet/device-status + */ +public enum FHIRDeviceStatus: String, FHIRPrimitiveType { + + /// The Device is available for use. Note: This means for *implanted devices* the device is implanted in the + /// patient. + case active = "active" + + /// The Device is no longer available for use (e.g. lost, expired, damaged). Note: This means for *implanted + /// devices* the device has been removed from the patient. + case inactive = "inactive" + + /// The Device was entered in error and voided. + case enteredInError = "entered-in-error" + + /// The status of the device has not been determined. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemFHIRRestfulInteractions.swift b/Sources/ModelsSTU3/CodeSystemFHIRRestfulInteractions.swift new file mode 100644 index 0000000..b42981c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemFHIRRestfulInteractions.swift @@ -0,0 +1,80 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The set of interactions defined by the RESTful part of the FHIR specification. + + URL: http://hl7.org/fhir/restful-interaction + ValueSet: http://hl7.org/fhir/ValueSet/restful-interaction + */ +public enum FHIRRestfulInteractions: String, FHIRPrimitiveType { + + /// Read the current state of the resource. + case read = "read" + + /// Read the state of a specific version of the resource. + case vread = "vread" + + /// Update an existing resource by its id (or create it if it is new). + case update = "update" + + /// Update an existing resource by posting a set of changes to it. + case patch = "patch" + + /// Delete a resource. + case delete = "delete" + + /// Retrieve the change history for a particular resource, type of resource, or the entire system. + case history = "history" + + /// Retrieve the change history for a particular resource. + case historyInstance = "history-instance" + + /// Retrieve the change history for all resources of a particular type. + case historyType = "history-type" + + /// Retrieve the change history for all resources on a system. + case historySystem = "history-system" + + /// Create a new resource with a server assigned id. + case create = "create" + + /// Search a resource type or all resources based on some filter criteria. + case search = "search" + + /// Search all resources of the specified type based on some filter criteria. + case searchType = "search-type" + + /// Search all resources based on some filter criteria. + case searchSystem = "search-system" + + /// Get a Capability Statement for the system. + case capabilities = "capabilities" + + /// Update, create or delete a set of resources as a single transaction. + case transaction = "transaction" + + /// perform a set of a separate interactions in a single http operation + case batch = "batch" + + /// Perform an operation as defined by an OperationDefinition. + case operation = "operation" +} diff --git a/Sources/ModelsSTU3/CodeSystemFHIRSubstanceStatus.swift b/Sources/ModelsSTU3/CodeSystemFHIRSubstanceStatus.swift new file mode 100644 index 0000000..85819b2 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemFHIRSubstanceStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code to indicate if the substance is actively used + + URL: http://hl7.org/fhir/substance-status + ValueSet: http://hl7.org/fhir/ValueSet/substance-status + */ +public enum FHIRSubstanceStatus: String, FHIRPrimitiveType { + + /// The substance is considered for use or reference + case active = "active" + + /// The substance is considered for reference, but not for use + case inactive = "inactive" + + /// The substance was entered in error + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemFamilyHistoryNotDoneReason.swift b/Sources/ModelsSTU3/CodeSystemFamilyHistoryNotDoneReason.swift new file mode 100644 index 0000000..53933d5 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemFamilyHistoryNotDoneReason.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes describing the reason why a family member history was not done. + + URL: http://hl7.org/fhir/history-not-done-reason + ValueSet: http://hl7.org/fhir/ValueSet/history-not-done-reason + */ +public enum FamilyHistoryNotDoneReason: String, FHIRPrimitiveType { + + /// Patient does not know the subject, e.g. the biological parent of an adopted patient. + case subjectUnknown = "subject-unknown" + + /// The patient withheld or refused to share the information. + case withheld = "withheld" + + /// Information cannot be obtained; e.g. unconscious patient + case unableToObtain = "unable-to-obtain" + + /// Patient does not have the information now, but can provide the information at a later date. + case deferred = "deferred" +} diff --git a/Sources/ModelsSTU3/CodeSystemFamilyHistoryStatus.swift b/Sources/ModelsSTU3/CodeSystemFamilyHistoryStatus.swift new file mode 100644 index 0000000..2e69c06 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemFamilyHistoryStatus.swift @@ -0,0 +1,42 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code that identifies the status of the family history record. + + URL: http://hl7.org/fhir/history-status + ValueSet: http://hl7.org/fhir/ValueSet/history-status + */ +public enum FamilyHistoryStatus: String, FHIRPrimitiveType { + + /// Some health information is known and captured, but not complete - see notes for details. + case partial = "partial" + + /// All available related health information is captured as of the date (and possibly time) when the family member + /// history was taken. + case completed = "completed" + + /// This instance should not have been part of this patient's medical record. + case enteredInError = "entered-in-error" + + /// Health information for this individual is unavailable/unknown. + case healthUnknown = "health-unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemFilterOperator.swift b/Sources/ModelsSTU3/CodeSystemFilterOperator.swift new file mode 100644 index 0000000..38b2bd6 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemFilterOperator.swift @@ -0,0 +1,62 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The kind of operation to perform as a part of a property based filter. + + URL: http://hl7.org/fhir/filter-operator + ValueSet: http://hl7.org/fhir/ValueSet/filter-operator + */ +public enum FilterOperator: String, FHIRPrimitiveType { + + /// The specified property of the code equals the provided value. + case eq = "=" + + /// Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, + /// including the provided concept itself (i.e. include child codes) + case isA = "is-a" + + /// Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, + /// excluding the provided concept itself (i.e. include child codes) + case descendentOf = "descendent-of" + + /// The specified property of the code does not have an is-a relationship with the provided value. + case isNotA = "is-not-a" + + /// The specified property of the code matches the regex specified in the provided value. + case regex = "regex" + + /// The specified property of the code is in the set of codes or concepts specified in the provided value (comma + /// separated list). + case `in` = "in" + + /// The specified property of the code is not in the set of codes or concepts specified in the provided value (comma + /// separated list). + case notIn = "not-in" + + /// Includes all concept ids that have a transitive is-a relationship from the concept Id provided as the value, + /// including the provided concept itself (e.g. include parent codes) + case generalizes = "generalizes" + + /// The specified property of the code has at least one value (if the specified value is true; if the specified + /// value is false, then matches when the specified property of the code has no values) + case exists = "exists" +} diff --git a/Sources/ModelsSTU3/CodeSystemFlagStatus.swift b/Sources/ModelsSTU3/CodeSystemFlagStatus.swift new file mode 100644 index 0000000..6f46f6f --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemFlagStatus.swift @@ -0,0 +1,40 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates whether this flag is active and needs to be displayed to a user, or whether it is no longer needed or entered + in error. + + URL: http://hl7.org/fhir/flag-status + ValueSet: http://hl7.org/fhir/ValueSet/flag-status + */ +public enum FlagStatus: String, FHIRPrimitiveType { + + /// A current flag that should be displayed to a user. A system may use the category to determine which roles should + /// view the flag. + case active = "active" + + /// The flag does not need to be displayed any more. + case inactive = "inactive" + + /// The flag was added in error, and should no longer be displayed. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemGoalAcceptanceStatus.swift b/Sources/ModelsSTU3/CodeSystemGoalAcceptanceStatus.swift new file mode 100644 index 0000000..9b4e6c7 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemGoalAcceptanceStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes indicating whether the goal has been accepted by a stakeholder + + URL: http://hl7.org/fhir/goal-acceptance-status + ValueSet: http://hl7.org/fhir/ValueSet/goal-acceptance-status + */ +public enum GoalAcceptanceStatus: String, FHIRPrimitiveType { + + /// Stakeholder supports pursuit of the goal + case agree = "agree" + + /// Stakeholder is not in support of the pursuit of the goal + case disagree = "disagree" + + /// Stakeholder has not yet made a decision on whether they support the goal + case pending = "pending" +} diff --git a/Sources/ModelsSTU3/CodeSystemGoalRelationshipType.swift b/Sources/ModelsSTU3/CodeSystemGoalRelationshipType.swift new file mode 100644 index 0000000..5b17fbe --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemGoalRelationshipType.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Types of relationships between two goals + + URL: http://hl7.org/fhir/goal-relationship-type + ValueSet: http://hl7.org/fhir/ValueSet/goal-relationship-type + */ +public enum GoalRelationshipType: String, FHIRPrimitiveType { + + /// Indicates that the target goal is one which must be met before striving for the current goal + case predecessor = "predecessor" + + /// Indicates that the target goal is a desired objective once the current goal is met + case successor = "successor" + + /// Indicates that this goal has been replaced by the target goal + case replacement = "replacement" + + /// Indicates that the target goal is considered to be a "piece" of attaining this goal. + case milestone = "milestone" + + /// Indicates that the relationship is not covered by one of the pre-defined codes. (An extension may convey more + /// information about the meaning of the relationship.) + case other = "other" +} diff --git a/Sources/ModelsSTU3/CodeSystemGoalStatus.swift b/Sources/ModelsSTU3/CodeSystemGoalStatus.swift new file mode 100644 index 0000000..0a16836 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemGoalStatus.swift @@ -0,0 +1,69 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates whether the goal has been met and is still being targeted + + URL: http://hl7.org/fhir/goal-status + ValueSet: http://hl7.org/fhir/ValueSet/goal-status + */ +public enum GoalStatus: String, FHIRPrimitiveType { + + /// A goal is proposed for this patient + case proposed = "proposed" + + /// A proposed goal was accepted or acknowledged + case accepted = "accepted" + + /// A goal is planned for this patient + case planned = "planned" + + /// The goal is being sought but has not yet been reached. (Also applies if goal was reached in the past but there + /// has been regression and goal is being sought again) + case inProgress = "in-progress" + + /// The goal is on schedule for the planned timelines + case onTarget = "on-target" + + /// The goal is ahead of the planned timelines + case aheadOfTarget = "ahead-of-target" + + /// The goal is behind the planned timelines + case behindTarget = "behind-target" + + /// The goal has been met, but ongoing activity is needed to sustain the goal objective + case sustaining = "sustaining" + + /// The goal has been met and no further action is needed + case achieved = "achieved" + + /// The goal remains a long term objective but is no longer being actively pursued for a temporary period of time. + case onHold = "on-hold" + + /// The previously accepted goal is no longer being sought + case cancelled = "cancelled" + + /// The goal was entered in error and voided. + case enteredInError = "entered-in-error" + + /// A proposed goal was rejected + case rejected = "rejected" +} diff --git a/Sources/ModelsSTU3/CodeSystemGraphCompartmentRule.swift b/Sources/ModelsSTU3/CodeSystemGraphCompartmentRule.swift new file mode 100644 index 0000000..1617948 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemGraphCompartmentRule.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How a compartment must be linked + + URL: http://hl7.org/fhir/graph-compartment-rule + ValueSet: http://hl7.org/fhir/ValueSet/graph-compartment-rule + */ +public enum GraphCompartmentRule: String, FHIRPrimitiveType { + + /// The compartment must be identical (the same literal reference) + case identical = "identical" + + /// The compartment must be the same - the record must be about the same patient, but the reference may be different + case matching = "matching" + + /// The compartment must be different + case different = "different" + + /// The compartment rule is defined in the accompanying FHIRPath expression + case custom = "custom" +} diff --git a/Sources/ModelsSTU3/CodeSystemGroupType.swift b/Sources/ModelsSTU3/CodeSystemGroupType.swift new file mode 100644 index 0000000..0b9d57a --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemGroupType.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Types of resources that are part of group + + URL: http://hl7.org/fhir/group-type + ValueSet: http://hl7.org/fhir/ValueSet/group-type + */ +public enum GroupType: String, FHIRPrimitiveType { + + /// Group contains "person" Patient resources + case person = "person" + + /// Group contains "animal" Patient resources + case animal = "animal" + + /// Group contains healthcare practitioner resources + case practitioner = "practitioner" + + /// Group contains Device resources + case device = "device" + + /// Group contains Medication resources + case medication = "medication" + + /// Group contains Substance resources + case substance = "substance" +} diff --git a/Sources/ModelsSTU3/CodeSystemGuidanceResponseStatus.swift b/Sources/ModelsSTU3/CodeSystemGuidanceResponseStatus.swift new file mode 100644 index 0000000..772c98a --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemGuidanceResponseStatus.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The status of a guidance response + + URL: http://hl7.org/fhir/guidance-response-status + ValueSet: http://hl7.org/fhir/ValueSet/guidance-response-status + */ +public enum GuidanceResponseStatus: String, FHIRPrimitiveType { + + /// The request was processed successfully + case success = "success" + + /// The request was processed successfully, but more data may result in a more complete evaluation + case dataRequested = "data-requested" + + /// The request was processed, but more data is required to complete the evaluation + case dataRequired = "data-required" + + /// The request is currently being processed + case inProgress = "in-progress" + + /// The request was not processed successfully + case failure = "failure" + + /// The response was entered in error + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemGuideDependencyType.swift b/Sources/ModelsSTU3/CodeSystemGuideDependencyType.swift new file mode 100644 index 0000000..ffef7a8 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemGuideDependencyType.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How a dependency is represented when the guide is published. + + URL: http://hl7.org/fhir/guide-dependency-type + ValueSet: http://hl7.org/fhir/ValueSet/guide-dependency-type + */ +public enum GuideDependencyType: String, FHIRPrimitiveType { + + /// The guide is referred to by URL. + case reference = "reference" + + /// The guide is embedded in this guide when published. + case inclusion = "inclusion" +} diff --git a/Sources/ModelsSTU3/CodeSystemGuidePageKind.swift b/Sources/ModelsSTU3/CodeSystemGuidePageKind.swift new file mode 100644 index 0000000..10cc235 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemGuidePageKind.swift @@ -0,0 +1,55 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The kind of an included page. + + URL: http://hl7.org/fhir/guide-page-kind + ValueSet: http://hl7.org/fhir/ValueSet/guide-page-kind + */ +public enum GuidePageKind: String, FHIRPrimitiveType { + + /// This is a page of content that is included in the implementation guide. It has no particular function. + case page = "page" + + /// This is a page that represents a human readable rendering of an example. + case example = "example" + + /// This is a page that represents a list of resources of one or more types. + case list = "list" + + /// This is a page showing where an included guide is injected. + case include = "include" + + /// This is a page that lists the resources of a given type, and also creates pages for all the listed types as + /// other pages in the section. + case directory = "directory" + + /// This is a page that creates the listed resources as a dictionary. + case dictionary = "dictionary" + + /// This is a generated page that contains the table of contents. + case toc = "toc" + + /// This is a page that represents a presented resource. This is typically used for generated conformance resource + /// presentations. + case resource = "resource" +} diff --git a/Sources/ModelsSTU3/CodeSystemHL7Workgroup.swift b/Sources/ModelsSTU3/CodeSystemHL7Workgroup.swift new file mode 100644 index 0000000..7a193d3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemHL7Workgroup.swift @@ -0,0 +1,98 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + An HL7 administrative unit that owns artifacts in the FHIR specification + + URL: http://hl7.org/fhir/hl7-work-group + ValueSet: http://hl7.org/fhir/ValueSet/hl7-work-group + */ +public enum HL7Workgroup: String, FHIRPrimitiveType { + + /// Community Based Collaborative Care (http://www.hl7.org/Special/committees/cbcc/index.cfm) + case cbcc = "cbcc" + + /// Clinical Decision Support (http://www.hl7.org/Special/committees/dss/index.cfm) + case cds = "cds" + + /// Clinical Quality Information (http://www.hl7.org/Special/committees/cqi/index.cfm) + case cqi = "cqi" + + /// Clinical Genomics (http://www.hl7.org/Special/committees/clingenomics/index.cfm) + case cg = "cg" + + /// Health Care Devices (http://www.hl7.org/Special/committees/healthcaredevices/index.cfm) + case dev = "dev" + + /// Electronic Health Records (http://www.hl7.org/special/committees/ehr/index.cfm) + case ehr = "ehr" + + /// FHIR Infrastructure (http://www.hl7.org/Special/committees/fiwg/index.cfm) + case fhir = "fhir" + + /// Financial Management (http://www.hl7.org/Special/committees/fm/index.cfm) + case fm = "fm" + + /// Health Standards Integration (http://www.hl7.org/Special/committees/hsi/index.cfm) + case hsi = "hsi" + + /// Imaging Integration (http://www.hl7.org/Special/committees/imagemgt/index.cfm) + case ii = "ii" + + /// Infrastructure And Messaging (http://www.hl7.org/special/committees/inm/index.cfm) + case inm = "inm" + + /// Implementable Technology Specifications (http://www.hl7.org/special/committees/xml/index.cfm) + case its = "its" + + /// Orders and Observations (http://www.hl7.org/Special/committees/orders/index.cfm) + case oo = "oo" + + /// Patient Administration (http://www.hl7.org/Special/committees/pafm/index.cfm) + case pa = "pa" + + /// Patient Care (http://www.hl7.org/Special/committees/patientcare/index.cfm) + case pc = "pc" + + /// Public Health and Emergency Response (http://www.hl7.org/Special/committees/pher/index.cfm) + case pher = "pher" + + /// Pharmacy (http://www.hl7.org/Special/committees/medication/index.cfm) + case phx = "phx" + + /// Regulated Clinical Research Information Management (http://www.hl7.org/Special/committees/rcrim/index.cfm) + case rcrim = "rcrim" + + /// Structured Documents (http://www.hl7.org/Special/committees/structure/index.cfm) + case sd = "sd" + + /// Security (http://www.hl7.org/Special/committees/secure/index.cfm) + case sec = "sec" + + /// US Realm Taskforce (http://wiki.hl7.org/index.php?title=US_Realm_Task_Force) + case us = "us" + + /// Vocabulary (http://www.hl7.org/Special/committees/Vocab/index.cfm) + case vocab = "vocab" + + /// Application Implementation and Design (http://www.hl7.org/Special/committees/java/index.cfm) + case aid = "aid" +} diff --git a/Sources/ModelsSTU3/CodeSystemHTTPVerb.swift b/Sources/ModelsSTU3/CodeSystemHTTPVerb.swift new file mode 100644 index 0000000..d8f0c7c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemHTTPVerb.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + HTTP verbs (in the HTTP command line). + + URL: http://hl7.org/fhir/http-verb + ValueSet: http://hl7.org/fhir/ValueSet/http-verb + */ +public enum HTTPVerb: String, FHIRPrimitiveType { + + /// HTTP GET + case GET = "GET" + + /// HTTP POST + case POST = "POST" + + /// HTTP PUT + case PUT = "PUT" + + /// HTTP DELETE + case DELETE = "DELETE" +} diff --git a/Sources/ModelsSTU3/CodeSystemHumanNameAssemblyOrder.swift b/Sources/ModelsSTU3/CodeSystemHumanNameAssemblyOrder.swift new file mode 100644 index 0000000..e690764 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemHumanNameAssemblyOrder.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code that represents the preferred display order of the components of a human name + + URL: http://hl7.org/fhir/name-assembly-order + ValueSet: http://hl7.org/fhir/ValueSet/name-assembly-order + */ +public enum HumanNameAssemblyOrder: String, FHIRPrimitiveType { + + /// NL1 + case NL1 = "NL1" + + /// NL2 + case NL2 = "NL2" + + /// NL3 + case NL3 = "NL3" + + /// NL4 + case NL4 = "NL4" +} diff --git a/Sources/ModelsSTU3/CodeSystemIdentifierUse.swift b/Sources/ModelsSTU3/CodeSystemIdentifierUse.swift new file mode 100644 index 0000000..7e9b242 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemIdentifierUse.swift @@ -0,0 +1,42 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Identifies the purpose for this identifier, if known . + + URL: http://hl7.org/fhir/identifier-use + ValueSet: http://hl7.org/fhir/ValueSet/identifier-use + */ +public enum IdentifierUse: String, FHIRPrimitiveType { + + /// The identifier recommended for display and use in real-world interactions. + case usual = "usual" + + /// The identifier considered to be most trusted for the identification of this item. + case official = "official" + + /// A temporary identifier. + case temp = "temp" + + /// An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but + /// cannot be consistently assigned to the same object again in a different context. + case secondary = "secondary" +} diff --git a/Sources/ModelsSTU3/CodeSystemIdentityAssuranceLevel.swift b/Sources/ModelsSTU3/CodeSystemIdentityAssuranceLevel.swift new file mode 100644 index 0000000..63d162a --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemIdentityAssuranceLevel.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The level of confidence that this link represents the same actual person, based on NIST Authentication Levels. + + URL: http://hl7.org/fhir/identity-assuranceLevel + ValueSet: http://hl7.org/fhir/ValueSet/identity-assuranceLevel + */ +public enum IdentityAssuranceLevel: String, FHIRPrimitiveType { + + /// Little or no confidence in the asserted identity's accuracy. + case level1 = "level1" + + /// Some confidence in the asserted identity's accuracy. + case level2 = "level2" + + /// High confidence in the asserted identity's accuracy. + case level3 = "level3" + + /// Very high confidence in the asserted identity's accuracy. + case level4 = "level4" +} diff --git a/Sources/ModelsSTU3/CodeSystemImplantStatus.swift b/Sources/ModelsSTU3/CodeSystemImplantStatus.swift new file mode 100644 index 0000000..5b97397 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemImplantStatus.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A set codes that define the functional status of an implanted device. + + URL: http://hl7.org/fhir/implant-status + ValueSet: http://hl7.org/fhir/ValueSet/implant-status + */ +public enum ImplantStatus: String, FHIRPrimitiveType { + + /// The implanted device is working normally + case functional = "functional" + + /// The implanted device is not working + case nonFunctional = "non-functional" + + /// The implanted device has been turned off + case disabled = "disabled" + + /// the functional status of the implant has not been determined + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemIssueSeverity.swift b/Sources/ModelsSTU3/CodeSystemIssueSeverity.swift new file mode 100644 index 0000000..9a9c172 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemIssueSeverity.swift @@ -0,0 +1,42 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How the issue affects the success of the action. + + URL: http://hl7.org/fhir/issue-severity + ValueSet: http://hl7.org/fhir/ValueSet/issue-severity + */ +public enum IssueSeverity: String, FHIRPrimitiveType { + + /// The issue caused the action to fail, and no further checking could be performed. + case fatal = "fatal" + + /// The issue is sufficiently important to cause the action to fail. + case error = "error" + + /// The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or + /// in a way that is not as desired. + case warning = "warning" + + /// The issue has no relation to the degree of success of the action. + case information = "information" +} diff --git a/Sources/ModelsSTU3/CodeSystemIssueType.swift b/Sources/ModelsSTU3/CodeSystemIssueType.swift new file mode 100644 index 0000000..4df0b28 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemIssueType.swift @@ -0,0 +1,128 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code that describes the type of issue. + + URL: http://hl7.org/fhir/issue-type + ValueSet: http://hl7.org/fhir/ValueSet/issue-type + */ +public enum IssueType: String, FHIRPrimitiveType { + + /// Content invalid against the specification or a profile. + case invalid = "invalid" + + /// A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid + /// json syntax. + case structure = "structure" + + /// A required element is missing. + case required = "required" + + /// An element value is invalid. + case value = "value" + + /// A content validation rule failed - e.g. a schematron rule. + case invariant = "invariant" + + /// An authentication/authorization/permissions issue of some kind. + case security = "security" + + /// The client needs to initiate an authentication process. + case login = "login" + + /// The user or system was not able to be authenticated (either there is no process, or the proferred token is + /// unacceptable). + case unknown = "unknown" + + /// User session expired; a login may be required. + case expired = "expired" + + /// The user does not have the rights to perform this action. + case forbidden = "forbidden" + + /// Some information was not or may not have been returned due to business rules, consent or privacy rules, or + /// access permission constraints. This information may be accessible through alternate processes. + case suppressed = "suppressed" + + /// Processing issues. These are expected to be final e.g. there is no point resubmitting the same content + /// unchanged. + case processing = "processing" + + /// The resource or profile is not supported. + case notSupported = "not-supported" + + /// An attempt was made to create a duplicate record. + case duplicate = "duplicate" + + /// The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this + /// code may be used where the content is not found further into the application architecture. + case notFound = "not-found" + + /// Provided content is too long (typically, this is a denial of service protection type of error). + case tooLong = "too-long" + + /// The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code. + case codeInvalid = "code-invalid" + + /// An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not + /// recognized. + case `extension` = "extension" + + /// The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED + /// CT. + case tooCostly = "too-costly" + + /// The content/operation failed to pass some business rule, and so could not proceed. + case businessRule = "business-rule" + + /// Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful + /// environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further + /// into the application architecture.) + case conflict = "conflict" + + /// Not all data sources typically accessed could be reached, or responded in time, so the returned information may + /// not be complete. + case incomplete = "incomplete" + + /// Transient processing issues. The system receiving the error may be able to resubmit the same content once an + /// underlying issue is resolved. + case transient = "transient" + + /// A resource/record locking failure (usually in an underlying database). + case lockError = "lock-error" + + /// The persistent store is unavailable; e.g. the database is down for maintenance or similar action. + case noStore = "no-store" + + /// An unexpected internal error has occurred. + case exception = "exception" + + /// An internal timeout has occurred. + case timeout = "timeout" + + /// The system is not prepared to handle this request due to load management. + case throttled = "throttled" + + /// A message unrelated to the processing success of the completed operation (examples of the latter include things + /// like reminders of password expiry, system maintenance times, etc.). + case informational = "informational" +} diff --git a/Sources/ModelsSTU3/CodeSystemLibraryType.swift b/Sources/ModelsSTU3/CodeSystemLibraryType.swift new file mode 100644 index 0000000..eaafbdf --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemLibraryType.swift @@ -0,0 +1,42 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of knowledge asset this library contains + + URL: http://hl7.org/fhir/library-type + ValueSet: http://hl7.org/fhir/ValueSet/library-type + */ +public enum LibraryType: String, FHIRPrimitiveType { + + /// The resource is a shareable library of formalized knowledge + case logicLibrary = "logic-library" + + /// The resource is a definition of an information model + case modelDefinition = "model-definition" + + /// The resource is a collection of knowledge assets + case assetCollection = "asset-collection" + + /// The resource defines the dependencies, parameters, and data requirements for a particular module or evaluation + /// context + case moduleDefinition = "module-definition" +} diff --git a/Sources/ModelsSTU3/CodeSystemLinkType.swift b/Sources/ModelsSTU3/CodeSystemLinkType.swift new file mode 100644 index 0000000..474e499 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemLinkType.swift @@ -0,0 +1,49 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of link between this patient resource and another patient resource. + + URL: http://hl7.org/fhir/link-type + ValueSet: http://hl7.org/fhir/ValueSet/link-type + */ +public enum LinkType: String, FHIRPrimitiveType { + + /// The patient resource containing this link must no longer be used. The link points forward to another patient + /// resource that must be used in lieu of the patient resource that contains this link. + case replacedBy = "replaced-by" + + /// The patient resource containing this link is the current active patient record. The link points back to an + /// inactive patient resource that has been merged into this resource, and should be consulted to retrieve + /// additional referenced information. + case replaces = "replaces" + + /// The patient resource containing this link is in use and valid but not considered the main source of information + /// about a patient. The link points forward to another patient resource that should be consulted to retrieve + /// additional patient information. + case refer = "refer" + + /// The patient resource containing this link is in use and valid, but points to another patient resource that is + /// known to contain data about the same person. Data in this resource might overlap or contradict information found + /// in the other patient resource. This link does not indicate any relative importance of the resources concerned, + /// and both should be regarded as equally valid. + case seealso = "seealso" +} diff --git a/Sources/ModelsSTU3/CodeSystemLinkageType.swift b/Sources/ModelsSTU3/CodeSystemLinkageType.swift new file mode 100644 index 0000000..18c17ea --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemLinkageType.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Used to distinguish different roles a resource can play within a set of linked resources + + URL: http://hl7.org/fhir/linkage-type + ValueSet: http://hl7.org/fhir/ValueSet/linkage-type + */ +public enum LinkageType: String, FHIRPrimitiveType { + + /// The record represents the "source of truth" (from the perspective of this Linkage resource) for the underlying + /// event/condition/etc. + case source = "source" + + /// The record represents the alternative view of the underlying event/condition/etc. The record may still be + /// actively maintained, even though it is not considered to be the source of truth. + case alternate = "alternate" + + /// The record represents an obsolete record of the underlyng event/condition/etc. It is not expected to be + /// actively maintained. + case historical = "historical" +} diff --git a/Sources/ModelsSTU3/CodeSystemListMode.swift b/Sources/ModelsSTU3/CodeSystemListMode.swift new file mode 100644 index 0000000..f249799 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemListMode.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The processing mode that applies to this list + + URL: http://hl7.org/fhir/list-mode + ValueSet: http://hl7.org/fhir/ValueSet/list-mode + */ +public enum ListMode: String, FHIRPrimitiveType { + + /// This list is the master list, maintained in an ongoing fashion with regular updates as the real world list it is + /// tracking changes + case working = "working" + + /// This list was prepared as a snapshot. It should not be assumed to be current + case snapshot = "snapshot" + + /// A list that indicates where changes have been made or recommended + case changes = "changes" +} diff --git a/Sources/ModelsSTU3/CodeSystemListStatus.swift b/Sources/ModelsSTU3/CodeSystemListStatus.swift new file mode 100644 index 0000000..23cf0a4 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemListStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The current state of the list + + URL: http://hl7.org/fhir/list-status + ValueSet: http://hl7.org/fhir/ValueSet/list-status + */ +public enum ListStatus: String, FHIRPrimitiveType { + + /// The list is considered to be an active part of the patient's record. + case current = "current" + + /// The list is "old" and should no longer be considered accurate or relevant. + case retired = "retired" + + /// The list was never accurate. It is retained for medico-legal purposes only. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemLocationMode.swift b/Sources/ModelsSTU3/CodeSystemLocationMode.swift new file mode 100644 index 0000000..43fa31f --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemLocationMode.swift @@ -0,0 +1,36 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates whether a resource instance represents a specific location or a class of locations. + + URL: http://hl7.org/fhir/location-mode + ValueSet: http://hl7.org/fhir/ValueSet/location-mode + */ +public enum LocationMode: String, FHIRPrimitiveType { + + /// The Location resource represents a specific instance of a location (e.g. Operating Theatre 1A). + case instance = "instance" + + /// The Location represents a class of locations (e.g. Any Operating Theatre) although this class of locations could + /// be constrained within a specific boundary (such as organization, or parent location, address etc.). + case kind = "kind" +} diff --git a/Sources/ModelsSTU3/CodeSystemLocationStatus.swift b/Sources/ModelsSTU3/CodeSystemLocationStatus.swift new file mode 100644 index 0000000..731db73 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemLocationStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates whether the location is still in use. + + URL: http://hl7.org/fhir/location-status + ValueSet: http://hl7.org/fhir/ValueSet/location-status + */ +public enum LocationStatus: String, FHIRPrimitiveType { + + /// The location is operational. + case active = "active" + + /// The location is temporarily closed. + case suspended = "suspended" + + /// The location is no longer used. + case inactive = "inactive" +} diff --git a/Sources/ModelsSTU3/CodeSystemMatchGrade.swift b/Sources/ModelsSTU3/CodeSystemMatchGrade.swift new file mode 100644 index 0000000..9d471ea --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMatchGrade.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A Master Patient Index (MPI) assessment of whether a candidate patient record is a match or not. + + URL: http://hl7.org/fhir/match-grade + ValueSet: http://hl7.org/fhir/ValueSet/match-grade + */ +public enum MatchGrade: String, FHIRPrimitiveType { + + /// This record meets the matching criteria to be automatically considered as a full match. + case certain = "certain" + + /// This record is a close match, but not a certain match. Additional review (e.g. by a human) may be required + /// before using this as a match. + case probable = "probable" + + /// This record may be a matching one. Additional review (e.g. by a human) SHOULD be performed before using this as + /// a match. + case possible = "possible" + + /// This record is known not to be a match. Note that usually non-matching records are not returned, but in some + /// cases records previously or likely considered as a match may specifically be negated by the matching engine + case certainlyNot = "certainly-not" +} diff --git a/Sources/ModelsSTU3/CodeSystemMaxOccurs.swift b/Sources/ModelsSTU3/CodeSystemMaxOccurs.swift new file mode 100644 index 0000000..21a0095 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMaxOccurs.swift @@ -0,0 +1,32 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Flags an element as having unlimited repetitions + + URL: http://hl7.org/fhir/question-max-occurs + ValueSet: http://hl7.org/fhir/ValueSet/question-max-occurs + */ +public enum MaxOccurs: String, FHIRPrimitiveType { + + /// Element can repeat an unlimited number of times + case max = "*" +} diff --git a/Sources/ModelsSTU3/CodeSystemMeasmntPrinciple.swift b/Sources/ModelsSTU3/CodeSystemMeasmntPrinciple.swift new file mode 100644 index 0000000..bcc807f --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMeasmntPrinciple.swift @@ -0,0 +1,62 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Different measurement principle supported by the device. + + URL: http://hl7.org/fhir/measurement-principle + ValueSet: http://hl7.org/fhir/ValueSet/measurement-principle + */ +public enum MeasmntPrinciple: String, FHIRPrimitiveType { + + /// Measurement principle isn't in the list. + case other = "other" + + /// Measurement is done using the chemical principle. + case chemical = "chemical" + + /// Measurement is done using the electrical principle. + case electrical = "electrical" + + /// Measurement is done using the impedance principle. + case impedance = "impedance" + + /// Measurement is done using the nuclear principle. + case nuclear = "nuclear" + + /// Measurement is done using the optical principle. + case optical = "optical" + + /// Measurement is done using the thermal principle. + case thermal = "thermal" + + /// Measurement is done using the biological principle. + case biological = "biological" + + /// Measurement is done using the mechanical principle. + case mechanical = "mechanical" + + /// Measurement is done using the acoustical principle. + case acoustical = "acoustical" + + /// Measurement is done using the manual principle. + case manual = "manual" +} diff --git a/Sources/ModelsSTU3/CodeSystemMeasureDataUsage.swift b/Sources/ModelsSTU3/CodeSystemMeasureDataUsage.swift new file mode 100644 index 0000000..995a98b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMeasureDataUsage.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The intended usage for supplemental data elements in the measure + + URL: http://hl7.org/fhir/measure-data-usage + ValueSet: http://hl7.org/fhir/ValueSet/measure-data-usage + */ +public enum MeasureDataUsage: String, FHIRPrimitiveType { + + /// The data is intended to be provided as additional information alongside the measure results + case supplementalData = "supplemental-data" + + /// The data is intended to be used to calculate and apply a risk adjustment model for the measure + case riskAdjustmentFactor = "risk-adjustment-factor" +} diff --git a/Sources/ModelsSTU3/CodeSystemMeasurePopulationType.swift b/Sources/ModelsSTU3/CodeSystemMeasurePopulationType.swift new file mode 100644 index 0000000..2c1d49d --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMeasurePopulationType.swift @@ -0,0 +1,76 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of population + + URL: http://hl7.org/fhir/measure-population + ValueSet: http://hl7.org/fhir/ValueSet/measure-population + */ +public enum MeasurePopulationType: String, FHIRPrimitiveType { + + /// The initial population refers to all patients or events to be evaluated by a quality measure involving patients + /// who share a common set of specified characterstics. All patients or events counted (for example, as numerator, + /// as denominator) are drawn from the initial population + case initialPopulation = "initial-population" + + /// The upper portion of a fraction used to calculate a rate, proportion, or ratio. Also called the measure focus, + /// it is the target process, condition, event, or outcome. Numerator criteria are the processes or outcomes + /// expected for each patient, or event defined in the denominator. A numerator statement describes the clinical + /// action that satisfies the conditions of the measure + case numerator = "numerator" + + /// Numerator exclusion criteria define patients or events to be removed from the numerator. Numerator exclusions + /// are used in proportion and ratio measures to help narrow the numerator (for inverted measures) + case numeratorExclusion = "numerator-exclusion" + + /// The lower portion of a fraction used to calculate a rate, proportion, or ratio. The denominator can be the same + /// as the initial population, or a subset of the initial population to further constrain the population for the + /// purpose of the measure + case denominator = "denominator" + + /// Denominator exclusion criteria define patients or events that should be removed from the denominator before + /// determining if numerator criteria are met. Denominator exclusions are used in proportion and ratio measures to + /// help narrow the denominator. For example, patients with bilateral lower extremity amputations would be listed as + /// a denominator exclusion for a measure requiring foot exams + case denominatorExclusion = "denominator-exclusion" + + /// Denominator exceptions are conditions that should remove a patient or event from the denominator of a measure + /// only if the numerator criteria are not met. Denominator exception allows for adjustment of the calculated score + /// for those providers with higher risk populations. Denominator exception criteria are only used in proportion + /// measures + case denominatorException = "denominator-exception" + + /// Measure population criteria define the patients or events for which the individual observation for the measure + /// should be taken. Measure populations are used for continuous variable measures rather than numerator and + /// denominator criteria + case measurePopulation = "measure-population" + + /// Measure population criteria define the patients or events that should be removed from the measure population + /// before determining the outcome of one or more continuous variables defined for the measure observation. Measure + /// population exclusion criteria are used within continuous variable measures to help narrow the measure population + case measurePopulationExclusion = "measure-population-exclusion" + + /// Defines the individual observation to be performed for each patient or event in the measure population. Measure + /// observations for each case in the population are aggregated to determine the overall measure score for the + /// population + case measureObservation = "measure-observation" +} diff --git a/Sources/ModelsSTU3/CodeSystemMeasureReportStatus.swift b/Sources/ModelsSTU3/CodeSystemMeasureReportStatus.swift new file mode 100644 index 0000000..f1f7be7 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMeasureReportStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The status of the measure report + + URL: http://hl7.org/fhir/measure-report-status + ValueSet: http://hl7.org/fhir/ValueSet/measure-report-status + */ +public enum MeasureReportStatus: String, FHIRPrimitiveType { + + /// The report is complete and ready for use + case complete = "complete" + + /// The report is currently being generated + case pending = "pending" + + /// An error occurred attempting to generate the report + case error = "error" +} diff --git a/Sources/ModelsSTU3/CodeSystemMeasureReportType.swift b/Sources/ModelsSTU3/CodeSystemMeasureReportType.swift new file mode 100644 index 0000000..45ad869 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMeasureReportType.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of the measure report + + URL: http://hl7.org/fhir/measure-report-type + ValueSet: http://hl7.org/fhir/ValueSet/measure-report-type + */ +public enum MeasureReportType: String, FHIRPrimitiveType { + + /// An individual report that provides information on the performance for a given measure with respect to a single + /// patient + case individual = "individual" + + /// A patient list report that includes a listing of patients that satisfied each population criteria in the measure + case patientList = "patient-list" + + /// A summary report that returns the number of patients in each population criteria for the measure + case summary = "summary" +} diff --git a/Sources/ModelsSTU3/CodeSystemMeasureScoring.swift b/Sources/ModelsSTU3/CodeSystemMeasureScoring.swift new file mode 100644 index 0000000..3251e4b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMeasureScoring.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The scoring type of the measure + + URL: http://hl7.org/fhir/measure-scoring + ValueSet: http://hl7.org/fhir/ValueSet/measure-scoring + */ +public enum MeasureScoring: String, FHIRPrimitiveType { + + /// The measure score is defined using a proportion + case proportion = "proportion" + + /// The measure score is defined using a ratio + case ratio = "ratio" + + /// The score is defined by a calculation of some quantity + case continuousVariable = "continuous-variable" + + /// The measure is a cohort definition + case cohort = "cohort" +} diff --git a/Sources/ModelsSTU3/CodeSystemMeasureType.swift b/Sources/ModelsSTU3/CodeSystemMeasureType.swift new file mode 100644 index 0000000..6b1a336 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMeasureType.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of measure (includes codes from 2.16.840.1.113883.1.11.20368) + + URL: http://hl7.org/fhir/measure-type + ValueSet: http://hl7.org/fhir/ValueSet/measure-type + */ +public enum MeasureType: String, FHIRPrimitiveType { + + /// A measure which focuses on a process which leads to a certain outcome, meaning that a scientific basis exists + /// for believing that the process, when executed well, will increase the probability of achieving a desired outcome + case process = "process" + + /// A measure that indicates the result of the performance (or non-performance) of a function or process + case outcome = "outcome" + + /// A measure that focuses on a health care provider's capacity, systems, and processes to provide high-quality care + case structure = "structure" + + /// A measure that focuses on patient-reported information such as patient engagement or patient experience measures + case patientReportedOutcome = "patient-reported-outcome" + + /// A measure that combines multiple component measures in to a single quality measure + case composite = "composite" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationAdministrationCategory.swift b/Sources/ModelsSTU3/CodeSystemMedicationAdministrationCategory.swift new file mode 100644 index 0000000..48ba046 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationAdministrationCategory.swift @@ -0,0 +1,40 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept describing where the medication administered is expected to occur + + URL: http://hl7.org/fhir/medication-admin-category + ValueSet: http://hl7.org/fhir/ValueSet/medication-admin-category + */ +public enum MedicationAdministrationCategory: String, FHIRPrimitiveType { + + /// Includes administrations in an inpatient or acute care setting + case inpatient = "inpatient" + + /// Includes administrations in an outpatient setting (for example, Emergency Department, Outpatient Clinic, + /// Outpatient Surgery, Doctor's office) + case outpatient = "outpatient" + + /// Includes administrations by the patient in their home (this would include long term care or nursing homes, + /// hospices, etc) + case community = "community" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationAdministrationStatus.swift b/Sources/ModelsSTU3/CodeSystemMedicationAdministrationStatus.swift new file mode 100644 index 0000000..db801c0 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationAdministrationStatus.swift @@ -0,0 +1,50 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A set of codes indicating the current status of a MedicationAdministration. + + URL: http://hl7.org/fhir/medication-admin-status + ValueSet: http://hl7.org/fhir/ValueSet/medication-admin-status + */ +public enum MedicationAdministrationStatus: String, FHIRPrimitiveType { + + /// The administration has started but has not yet completed. + case inProgress = "in-progress" + + /// Actions implied by the administration have been temporarily halted, but are expected to continue later. May also + /// be called "suspended". + case onHold = "on-hold" + + /// All actions that are implied by the administration have occurred. + case completed = "completed" + + /// The administration was entered in error and therefore nullified. + case enteredInError = "entered-in-error" + + /// Actions implied by the administration have been permanently halted, before all of them occurred. + case stopped = "stopped" + + /// The authoring system does not know which of the status values currently applies for this request. Note: This + /// concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known + /// which one. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationContainer.swift b/Sources/ModelsSTU3/CodeSystemMedicationContainer.swift new file mode 100644 index 0000000..b9eb80a --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationContainer.swift @@ -0,0 +1,54 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept defining the kind of container a medication package is packaged in + + URL: http://hl7.org/fhir/medication-package-form + ValueSet: http://hl7.org/fhir/ValueSet/medication-package-form + */ +public enum MedicationContainer: String, FHIRPrimitiveType { + + /// A sealed glass capsule containing a liquid + case ampoule = "ampoule" + + /// A container, typically made of glass or plastic and with a narrow neck, used for storing liquids. + case bottle = "bottle" + + /// A container with a flat base and sides, typically square or rectangular and having a lid. + case box = "box" + + /// A device of various configuration and composition used with a syringe for the application of anesthetic or other + /// materials to a patient. + case cartridge = "cartridge" + + /// A package intended to store pharmaceuticals. + case container = "container" + + /// A long, hollow cylinder of metal, plastic, glass, etc., for holding medications, typically creams or ointments + case tube = "tube" + + /// A dose of medicine prepared in an individual package for convenience, safety or monitoring. + case unitdose = "unitdose" + + /// A small container, typically cylindrical and made of glass, used especially for holding liquid medications. + case vial = "vial" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationDispenseCategory.swift b/Sources/ModelsSTU3/CodeSystemMedicationDispenseCategory.swift new file mode 100644 index 0000000..678a937 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationDispenseCategory.swift @@ -0,0 +1,40 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code describing where the dispensed medication is expected to be consumed or administered + + URL: http://hl7.org/fhir/medication-dispense-category + ValueSet: http://hl7.org/fhir/ValueSet/medication-dispense-category + */ +public enum MedicationDispenseCategory: String, FHIRPrimitiveType { + + /// Includes dispenses for medications to be administered or consumed in an inpatient or acute care setting + case inpatient = "inpatient" + + /// Includes dispenses for medications to be administered or consumed in an outpatient setting (for example, + /// Emergency Department, Outpatient Clinic, Outpatient Surgery, Doctor's office) + case outpatient = "outpatient" + + /// Includes dispenses for medications to be administered or consumed by the patient in their home (this would + /// include long term care or nursing homes, hospices, etc) + case community = "community" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationDispenseStatus.swift b/Sources/ModelsSTU3/CodeSystemMedicationDispenseStatus.swift new file mode 100644 index 0000000..5dfe2b5 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationDispenseStatus.swift @@ -0,0 +1,49 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept specifying the state of the dispense event. + + URL: http://hl7.org/fhir/medication-dispense-status + ValueSet: http://hl7.org/fhir/ValueSet/medication-dispense-status + */ +public enum MedicationDispenseStatus: String, FHIRPrimitiveType { + + /// The core event has not started yet, but some staging activities have begun (e.g. initial compounding or + /// packaging of medication). Preparation stages may be tracked for billing purposes. + case preparation = "preparation" + + /// The dispense has started but has not yet completed. + case inProgress = "in-progress" + + /// Actions implied by the administration have been temporarily halted, but are expected to continue later. May also + /// be called "suspended" + case onHold = "on-hold" + + /// All actions that are implied by the dispense have occurred. + case completed = "completed" + + /// The dispense was entered in error and therefore nullified. + case enteredInError = "entered-in-error" + + /// Actions implied by the dispense have been permanently halted, before all of them occurred. + case stopped = "stopped" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationRequestCategory.swift b/Sources/ModelsSTU3/CodeSystemMedicationRequestCategory.swift new file mode 100644 index 0000000..450c744 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationRequestCategory.swift @@ -0,0 +1,40 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept identifying where the medication ordered is expected to be consumed or administered + + URL: http://hl7.org/fhir/medication-request-category + ValueSet: http://hl7.org/fhir/ValueSet/medication-request-category + */ +public enum MedicationRequestCategory: String, FHIRPrimitiveType { + + /// Includes orders for medications to be administered or consumed in an inpatient or acute care setting + case inpatient = "inpatient" + + /// Includes orders for medications to be administered or consumed in an outpatient setting (for example, Emergency + /// Department, Outpatient Clinic, Outpatient Surgery, Doctor's office) + case outpatient = "outpatient" + + /// Includes orders for medications to be administered or consumed by the patient in their home (this would include + /// long term care or nursing homes, hospices, etc) + case community = "community" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationRequestIntent.swift b/Sources/ModelsSTU3/CodeSystemMedicationRequestIntent.swift new file mode 100644 index 0000000..09140c9 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationRequestIntent.swift @@ -0,0 +1,43 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The kind of medication order + + URL: http://hl7.org/fhir/medication-request-intent + ValueSet: http://hl7.org/fhir/ValueSet/medication-request-intent + */ +public enum MedicationRequestIntent: String, FHIRPrimitiveType { + + /// The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and + /// without providing an authorization to act + case proposal = "proposal" + + /// The request represents an intension to ensure something occurs without providing an authorization for others to + /// act + case plan = "plan" + + /// The request represents a request/demand and authorization for action + case order = "order" + + /// The request represents an instance for the particular order, for example a medication administration record. + case instanceOrder = "instance-order" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationRequestPriority.swift b/Sources/ModelsSTU3/CodeSystemMedicationRequestPriority.swift new file mode 100644 index 0000000..a244957 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationRequestPriority.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Identifies the level of importance to be assigned to actioning the request + + URL: http://hl7.org/fhir/medication-request-priority + ValueSet: http://hl7.org/fhir/ValueSet/medication-request-priority + */ +public enum MedicationRequestPriority: String, FHIRPrimitiveType { + + /// The order has a normal priority . + case routine = "routine" + + /// The order should be urgently. + case urgent = "urgent" + + /// The order is time-critical. + case stat = "stat" + + /// The order should be acted on as soon as possible. + case asap = "asap" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationRequestStatus.swift b/Sources/ModelsSTU3/CodeSystemMedicationRequestStatus.swift new file mode 100644 index 0000000..b185648 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationRequestStatus.swift @@ -0,0 +1,55 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept specifying the state of the prescribing event. Describes the lifecycle of the prescription + + URL: http://hl7.org/fhir/medication-request-status + ValueSet: http://hl7.org/fhir/ValueSet/medication-request-status + */ +public enum MedicationRequestStatus: String, FHIRPrimitiveType { + + /// The prescription is 'actionable', but not all actions that are implied by it have occurred yet. + case active = "active" + + /// Actions implied by the prescription are to be temporarily halted, but are expected to continue later. May also + /// be called "suspended". + case onHold = "on-hold" + + /// The prescription has been withdrawn. + case cancelled = "cancelled" + + /// All actions that are implied by the prescription have occurred. + case completed = "completed" + + /// The prescription was entered in error. + case enteredInError = "entered-in-error" + + /// Actions implied by the prescription are to be permanently halted, before all of them occurred. + case stopped = "stopped" + + /// The prescription is not yet 'actionable', i.e. it is a work in progress, requires sign-off or verification, and + /// needs to be run through decision support process. + case draft = "draft" + + /// The authoring system does not know which of the status values currently applies for this request + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationStatementCategory.swift b/Sources/ModelsSTU3/CodeSystemMedicationStatementCategory.swift new file mode 100644 index 0000000..4ab6c22 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationStatementCategory.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept identifying where the medication included in the medicationstatement is expected to be consumed or + administered + + URL: http://hl7.org/fhir/medication-statement-category + ValueSet: http://hl7.org/fhir/ValueSet/medication-statement-category + */ +public enum MedicationStatementCategory: String, FHIRPrimitiveType { + + /// Includes orders for medications to be administered or consumed in an inpatient or acute care setting + case inpatient = "inpatient" + + /// Includes orders for medications to be administered or consumed in an outpatient setting (for example, Emergency + /// Department, Outpatient Clinic, Outpatient Surgery, Doctor's office) + case outpatient = "outpatient" + + /// Includes orders for medications to be administered or consumed by the patient in their home (this would include + /// long term care or nursing homes, hospices, etc) + case community = "community" + + /// Includes statements about medication use, including over the counter medication, provided by the patient, agent + /// or another provider + case patientspecified = "patientspecified" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationStatementStatus.swift b/Sources/ModelsSTU3/CodeSystemMedicationStatementStatus.swift new file mode 100644 index 0000000..e6bcc77 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationStatementStatus.swift @@ -0,0 +1,48 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept indicating the current status of a MedicationStatement. + + URL: http://hl7.org/fhir/medication-statement-status + ValueSet: http://hl7.org/fhir/ValueSet/medication-statement-status + */ +public enum MedicationStatementStatus: String, FHIRPrimitiveType { + + /// The medication is still being taken. + case active = "active" + + /// The medication is no longer being taken. + case completed = "completed" + + /// The statement was recorded incorrectly. + case enteredInError = "entered-in-error" + + /// The medication may be taken at some time in the future. + case intended = "intended" + + /// Actions implied by the statement have been permanently halted, before all of them occurred. + case stopped = "stopped" + + /// Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be + /// called "suspended". + case onHold = "on-hold" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationStatementTaken.swift b/Sources/ModelsSTU3/CodeSystemMedicationStatementTaken.swift new file mode 100644 index 0000000..ec50dfa --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationStatementTaken.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept identifying level of certainty if patient has taken or has not taken the medication + + URL: http://hl7.org/fhir/medication-statement-taken + ValueSet: http://hl7.org/fhir/ValueSet/medication-statement-taken + */ +public enum MedicationStatementTaken: String, FHIRPrimitiveType { + + /// Positive assertion that patient has taken medication + case Y = "y" + + /// Negative assertion that patient has not taken medication + case N = "n" + + /// Unknown assertion if patient has taken medication + case unk = "unk" + + /// Patient reporting does not apply + case na = "na" +} diff --git a/Sources/ModelsSTU3/CodeSystemMedicationStatus.swift b/Sources/ModelsSTU3/CodeSystemMedicationStatus.swift new file mode 100644 index 0000000..b29820a --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMedicationStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept defining if the medication is in active use + + URL: http://hl7.org/fhir/medication-status + ValueSet: http://hl7.org/fhir/ValueSet/medication-status + */ +public enum MedicationStatus: String, FHIRPrimitiveType { + + /// The medication is available for use + case active = "active" + + /// The medication is not available for use + case inactive = "inactive" + + /// The medication was entered in error + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemMessageEvent.swift b/Sources/ModelsSTU3/CodeSystemMessageEvent.swift new file mode 100644 index 0000000..9a5cfef --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMessageEvent.swift @@ -0,0 +1,68 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + One of the message events defined as part of FHIR. + + URL: http://hl7.org/fhir/message-events + ValueSet: http://hl7.org/fhir/ValueSet/message-events + */ +public enum MessageEvent: String, FHIRPrimitiveType { + + /// The definition of a code system is used to create a simple collection of codes suitable for use for data entry + /// or validation. An expanded code system will be returned, or an error message. + case codeSystemExpand = "CodeSystem-expand" + + /// Change the status of a Medication Administration to show that it is complete. + case medicationAdministrationComplete = "MedicationAdministration-Complete" + + /// Someone wishes to record that the record of administration of a medication is in error and should be ignored. + case medicationAdministrationNullification = "MedicationAdministration-Nullification" + + /// Indicates that a medication has been recorded against the patient's record. + case medicationAdministrationRecording = "MedicationAdministration-Recording" + + /// Update a Medication Administration record. + case medicationAdministrationUpdate = "MedicationAdministration-Update" + + /// Notification of a change to an administrative resource (either create or update). Note that there is no delete, + /// though some administrative resources have status or period elements for this use. + case adminNotify = "admin-notify" + + /// Notification to convey information. + case communicationRequest = "communication-request" + + /// Provide a diagnostic report, or update a previously provided diagnostic report. + case diagnosticreportProvide = "diagnosticreport-provide" + + /// Provide a simple observation or update a previously provided simple observation. + case observationProvide = "observation-provide" + + /// Notification that two patient records actually identify the same patient. + case patientLink = "patient-link" + + /// Notification that previous advice that two patient records concern the same patient is now considered incorrect. + case patientUnlink = "patient-unlink" + + /// The definition of a value set is used to create a simple collection of codes suitable for use for data entry or + /// validation. An expanded value set will be returned, or an error message. + case valuesetExpand = "valueset-expand" +} diff --git a/Sources/ModelsSTU3/CodeSystemMessageSignificanceCategory.swift b/Sources/ModelsSTU3/CodeSystemMessageSignificanceCategory.swift new file mode 100644 index 0000000..70fbd77 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMessageSignificanceCategory.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The impact of the content of a message. + + URL: http://hl7.org/fhir/message-significance-category + ValueSet: http://hl7.org/fhir/ValueSet/message-significance-category + */ +public enum MessageSignificanceCategory: String, FHIRPrimitiveType { + + /// The message represents/requests a change that should not be processed more than once; e.g., making a booking for + /// an appointment. + case consequence = "Consequence" + + /// The message represents a response to query for current information. Retrospective processing is wrong and/or + /// wasteful. + case currency = "Currency" + + /// The content is not necessarily intended to be current, and it can be reprocessed, though there may be version + /// issues created by processing old notifications. + case notification = "Notification" +} diff --git a/Sources/ModelsSTU3/CodeSystemMessageTransport.swift b/Sources/ModelsSTU3/CodeSystemMessageTransport.swift new file mode 100644 index 0000000..b1b2c23 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMessageTransport.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The protocol used for message transport. + + URL: http://hl7.org/fhir/message-transport + ValueSet: http://hl7.org/fhir/ValueSet/message-transport + */ +public enum MessageTransport: String, FHIRPrimitiveType { + + /// The application sends or receives messages using HTTP POST (may be over http: or https:). + case http = "http" + + /// The application sends or receives messages using File Transfer Protocol. + case ftp = "ftp" + + /// The application sends or receives messages using HL7's Minimal Lower Level Protocol. + case mllp = "mllp" +} diff --git a/Sources/ModelsSTU3/CodeSystemMessageheaderResponseRequest.swift b/Sources/ModelsSTU3/CodeSystemMessageheaderResponseRequest.swift new file mode 100644 index 0000000..d6d6bb3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemMessageheaderResponseRequest.swift @@ -0,0 +1,42 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + HL7-defined table of codes which identify conditions under which acknowledgments are required to be returned in + response to a message. + + URL: http://hl7.org/fhir/messageheader-response-request + ValueSet: http://hl7.org/fhir/ValueSet/messageheader-response-request + */ +public enum MessageheaderResponseRequest: String, FHIRPrimitiveType { + + /// initiator expects a response for this message + case always = "always" + + /// initiator expects a response only if in error + case onError = "on-error" + + /// initiator does not expect a response + case never = "never" + + /// initiator expects a response only if successful + case onSuccess = "on-success" +} diff --git a/Sources/ModelsSTU3/CodeSystemNHINPurposeOfUse.swift b/Sources/ModelsSTU3/CodeSystemNHINPurposeOfUse.swift new file mode 100644 index 0000000..2543291 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemNHINPurposeOfUse.swift @@ -0,0 +1,111 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + This value set is suitable for use with the provenance resource. It is derived from, but not compatible with, the HL7 + v3 Purpose of use Code system. + + URL: http://healthit.gov/nhin/purposeofuse + ValueSet: http://hl7.org/fhir/ValueSet/nhin-purposeofuse + */ +public enum NHINPurposeOfUse: String, FHIRPrimitiveType { + + /// Treatment + case TREATMENT = "TREATMENT" + + /// Payment + case PAYMENT = "PAYMENT" + + /// Healthcare Operations + case OPERATIONS = "OPERATIONS" + + /// System Administration + case SYSADMIN = "SYSADMIN" + + /// Fraud detection + case FRAUD = "FRAUD" + + /// Use or disclosure of Psychotherapy Notes + case PSYCHOTHERAPY = "PSYCHOTHERAPY" + + /// Use or disclosure by the covered entity for its own training programs + case TRAINING = "TRAINING" + + /// Use or disclosure by the covered entity to defend itself in a legal action + case LEGAL = "LEGAL" + + /// Marketing + case MARKETING = "MARKETING" + + /// Use and disclosure for facility directories + case DIRECTORY = "DIRECTORY" + + /// Disclose to a family member, other relative, or a close personal friend of the individual + case FAMILY = "FAMILY" + + /// Uses and disclosures with the individual present. + case PRESENT = "PRESENT" + + /// Permission cannot practicably be provided because of the individual's incapacity or an emergency. + case EMERGENCY = "EMERGENCY" + + /// Use and disclosures for disaster relief purposes. + case DISASTER = "DISASTER" + + /// Uses and disclosures for public health activities. + case PUBLICHEALTH = "PUBLICHEALTH" + + /// Disclosures about victims of abuse, neglect or domestic violence. + case ABUSE = "ABUSE" + + /// Uses and disclosures for health oversight activities. + case OVERSIGHT = "OVERSIGHT" + + /// Disclosures for judicial and administrative proceedings. + case JUDICIAL = "JUDICIAL" + + /// Disclosures for law enforcement purposes. + case LAW = "LAW" + + /// Uses and disclosures about decedents. + case DECEASED = "DECEASED" + + /// Uses and disclosures for cadaveric organ, eye or tissue donation purposes + case DONATION = "DONATION" + + /// Uses and disclosures for research purposes. + case RESEARCH = "RESEARCH" + + /// Uses and disclosures to avert a serious threat to health or safety. + case THREAT = "THREAT" + + /// Uses and disclosures for specialized government functions. + case GOVERNMENT = "GOVERNMENT" + + /// Disclosures for workers' compensation. + case WORKERSCOMP = "WORKERSCOMP" + + /// Disclosures for insurance or disability coverage determination + case COVERAGE = "COVERAGE" + + /// Request of the Individual + case REQUEST = "REQUEST" +} diff --git a/Sources/ModelsSTU3/CodeSystemNameUse.swift b/Sources/ModelsSTU3/CodeSystemNameUse.swift new file mode 100644 index 0000000..0bb4b96 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemNameUse.swift @@ -0,0 +1,55 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The use of a human name + + URL: http://hl7.org/fhir/name-use + ValueSet: http://hl7.org/fhir/ValueSet/name-use + */ +public enum NameUse: String, FHIRPrimitiveType { + + /// Known as/conventional/the one you normally use + case usual = "usual" + + /// The formal name as registered in an official (government) registry, but which name might not be commonly used. + /// May be called "legal name". + case official = "official" + + /// A temporary name. Name.period can provide more detailed information. This may also be used for temporary names + /// assigned at birth or in emergency situations. + case temp = "temp" + + /// A name that is used to address the person in an informal manner, but is not part of their formal or usual name + case nickname = "nickname" + + /// Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons) + case anonymous = "anonymous" + + /// This name is no longer in use (or was never correct, but retained for records) + case old = "old" + + /// A name used prior to changing name because of marriage. This name use is for use by applications that collect + /// and store names that were used prior to a marriage. Marriage naming customs vary greatly around the world, and + /// are constantly changing. This term is not gender specific. The use of this term does not imply any particular + /// history for a person's name + case maiden = "maiden" +} diff --git a/Sources/ModelsSTU3/CodeSystemNamingSystemIdentifierType.swift b/Sources/ModelsSTU3/CodeSystemNamingSystemIdentifierType.swift new file mode 100644 index 0000000..54eba93 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemNamingSystemIdentifierType.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Identifies the style of unique identifier used to identify a namespace. + + URL: http://hl7.org/fhir/namingsystem-identifier-type + ValueSet: http://hl7.org/fhir/ValueSet/namingsystem-identifier-type + */ +public enum NamingSystemIdentifierType: String, FHIRPrimitiveType { + + /// An ISO object identifier; e.g. 1.2.3.4.5. + case oid = "oid" + + /// A universally unique identifier of the form a5afddf4-e880-459b-876e-e4591b0acc11. + case uuid = "uuid" + + /// A uniform resource identifier (ideally a URL - uniform resource locator); e.g. http://unitsofmeasure.org. + case uri = "uri" + + /// Some other type of unique identifier; e.g. HL7-assigned reserved string such as LN for LOINC. + case other = "other" +} diff --git a/Sources/ModelsSTU3/CodeSystemNamingSystemType.swift b/Sources/ModelsSTU3/CodeSystemNamingSystemType.swift new file mode 100644 index 0000000..f92b3e3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemNamingSystemType.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Identifies the purpose of the naming system. + + URL: http://hl7.org/fhir/namingsystem-type + ValueSet: http://hl7.org/fhir/ValueSet/namingsystem-type + */ +public enum NamingSystemType: String, FHIRPrimitiveType { + + /// The naming system is used to define concepts and symbols to represent those concepts; e.g. UCUM, LOINC, NDC + /// code, local lab codes, etc. + case codesystem = "codesystem" + + /// The naming system is used to manage identifiers (e.g. license numbers, order numbers, etc.). + case identifier = "identifier" + + /// The naming system is used as the root for other identifiers and naming systems. + case root = "root" +} diff --git a/Sources/ModelsSTU3/CodeSystemNarrativeStatus.swift b/Sources/ModelsSTU3/CodeSystemNarrativeStatus.swift new file mode 100644 index 0000000..a41ffec --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemNarrativeStatus.swift @@ -0,0 +1,43 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The status of a resource narrative + + URL: http://hl7.org/fhir/narrative-status + ValueSet: http://hl7.org/fhir/ValueSet/narrative-status + */ +public enum NarrativeStatus: String, FHIRPrimitiveType { + + /// The contents of the narrative are entirely generated from the structured data in the content. + case generated = "generated" + + /// The contents of the narrative are entirely generated from the structured data in the content and some of the + /// content is generated from extensions + case extensions = "extensions" + + /// The contents of the narrative may contain additional information not found in the structured data. Note that + /// there is no computable way to determine what the extra information is, other than by human inspection + case additional = "additional" + + /// The contents of the narrative are some equivalent of "No human-readable text provided in this case" + case empty = "empty" +} diff --git a/Sources/ModelsSTU3/CodeSystemNoteType.swift b/Sources/ModelsSTU3/CodeSystemNoteType.swift new file mode 100644 index 0000000..4202af6 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemNoteType.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The presentation types of notes. + + URL: http://hl7.org/fhir/note-type + ValueSet: http://hl7.org/fhir/ValueSet/note-type + */ +public enum NoteType: String, FHIRPrimitiveType { + + /// Display the note. + case display = "display" + + /// Print the note on the form. + case print = "print" + + /// Print the note for the operator. + case printoper = "printoper" +} diff --git a/Sources/ModelsSTU3/CodeSystemNutritionOrderStatus.swift b/Sources/ModelsSTU3/CodeSystemNutritionOrderStatus.swift new file mode 100644 index 0000000..c06604c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemNutritionOrderStatus.swift @@ -0,0 +1,58 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes specifying the state of the request. Describes the lifecycle of the nutrition order. + + URL: http://hl7.org/fhir/nutrition-request-status + ValueSet: http://hl7.org/fhir/ValueSet/nutrition-request-status + */ +public enum NutritionOrderStatus: String, FHIRPrimitiveType { + + /// The request has been proposed. + case proposed = "proposed" + + /// The request is in preliminary form prior to being sent. + case draft = "draft" + + /// The request has been planned. + case planned = "planned" + + /// The request has been placed. + case requested = "requested" + + /// The request is 'actionable', but not all actions that are implied by it have occurred yet. + case active = "active" + + /// Actions implied by the request have been temporarily halted, but are expected to continue later. May also be + /// called "suspended". + case onHold = "on-hold" + + /// All actions that are implied by the order have occurred and no continuation is planned (this will rarely be made + /// explicit). + case completed = "completed" + + /// The request has been withdrawn and is no longer actionable. + case cancelled = "cancelled" + + /// The request was entered in error and voided. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemObservationRelationshipType.swift b/Sources/ModelsSTU3/CodeSystemObservationRelationshipType.swift new file mode 100644 index 0000000..98f4145 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemObservationRelationshipType.swift @@ -0,0 +1,53 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes specifying how two observations are related. + + URL: http://hl7.org/fhir/observation-relationshiptypes + ValueSet: http://hl7.org/fhir/ValueSet/observation-relationshiptypes + */ +public enum ObservationRelationshipType: String, FHIRPrimitiveType { + + /// This observation is a group observation (e.g. a battery, a panel of tests, a set of vital sign measurements) + /// that includes the target as a member of the group. + case hasMember = "has-member" + + /// The target resource (Observation or QuestionnaireResponse) is part of the information from which this + /// observation value is derived. (e.g. calculated anion gap, Apgar score) NOTE: "derived-from" is the only + /// logical choice when referencing QuestionnaireResponse. + case derivedFrom = "derived-from" + + /// This observation follows the target observation (e.g. timed tests such as Glucose Tolerance Test). + case sequelTo = "sequel-to" + + /// This observation replaces a previous observation (i.e. a revised value). The target observation is now obsolete. + case replaces = "replaces" + + /// The value of the target observation qualifies (refines) the semantics of the source observation (e.g. a lipemia + /// measure target from a plasma measure). + case qualifiedBy = "qualified-by" + + /// The value of the target observation interferes (degrades quality, or prevents valid observation) with the + /// semantics of the source observation (e.g. a hemolysis measure target from a plasma potassium measure, which has + /// no value). + case interferedBy = "interfered-by" +} diff --git a/Sources/ModelsSTU3/CodeSystemObservationStatus.swift b/Sources/ModelsSTU3/CodeSystemObservationStatus.swift new file mode 100644 index 0000000..ba9ba2a --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemObservationStatus.swift @@ -0,0 +1,59 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes providing the status of an observation. + + URL: http://hl7.org/fhir/observation-status + ValueSet: http://hl7.org/fhir/ValueSet/observation-status + */ +public enum ObservationStatus: String, FHIRPrimitiveType { + + /// The existence of the observation is registered, but there is no result yet available. + case registered = "registered" + + /// This is an initial or interim observation: data may be incomplete or unverified. + case preliminary = "preliminary" + + /// The observation is complete. + case final = "final" + + /// Subsequent to being Final, the observation has been modified subsequent. This includes updates/new information + /// and corrections. + case amended = "amended" + + /// Subsequent to being Final, the observation has been modified to correct an error in the test result. + case corrected = "corrected" + + /// The observation is unavailable because the measurement was not started or not completed (also sometimes called + /// "aborted"). + case cancelled = "cancelled" + + /// The observation has been withdrawn following previous final release. This electronic record should never have + /// existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, + /// the status should be "cancelled" rather than "entered-in-error".) + case enteredInError = "entered-in-error" + + /// The authoring system does not know which of the status values currently applies for this request. Note: This + /// concept is not to be used for "other" - one of the listed statuses is presumed to apply, but the authoring + /// system does not know which. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemOperationKind.swift b/Sources/ModelsSTU3/CodeSystemOperationKind.swift new file mode 100644 index 0000000..6cea2d7 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemOperationKind.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Whether an operation is a normal operation or a query. + + URL: http://hl7.org/fhir/operation-kind + ValueSet: http://hl7.org/fhir/ValueSet/operation-kind + */ +public enum OperationKind: String, FHIRPrimitiveType { + + /// This operation is invoked as an operation. + case operation = "operation" + + /// This operation is a named query, invoked using the search mechanism. + case query = "query" +} diff --git a/Sources/ModelsSTU3/CodeSystemOperationOutcomeCodes.swift b/Sources/ModelsSTU3/CodeSystemOperationOutcomeCodes.swift new file mode 100644 index 0000000..c931ccf --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemOperationOutcomeCodes.swift @@ -0,0 +1,179 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Operation Outcome codes used by FHIR test servers (see Implementation file translations.xml) + + URL: http://hl7.org/fhir/operation-outcome + ValueSet: http://hl7.org/fhir/ValueSet/operation-outcome + */ +public enum OperationOutcomeCodes: String, FHIRPrimitiveType { + + /// MSG_AUTH_REQUIRED + case MSG_AUTH_REQUIRED = "MSG_AUTH_REQUIRED" + + /// MSG_BAD_FORMAT + case MSG_BAD_FORMAT = "MSG_BAD_FORMAT" + + /// MSG_BAD_SYNTAX + case MSG_BAD_SYNTAX = "MSG_BAD_SYNTAX" + + /// MSG_CANT_PARSE_CONTENT + case MSG_CANT_PARSE_CONTENT = "MSG_CANT_PARSE_CONTENT" + + /// MSG_CANT_PARSE_ROOT + case MSG_CANT_PARSE_ROOT = "MSG_CANT_PARSE_ROOT" + + /// MSG_CREATED + case MSG_CREATED = "MSG_CREATED" + + /// MSG_DATE_FORMAT + case MSG_DATE_FORMAT = "MSG_DATE_FORMAT" + + /// MSG_DELETED + case MSG_DELETED = "MSG_DELETED" + + /// MSG_DELETED_DONE + case MSG_DELETED_DONE = "MSG_DELETED_DONE" + + /// MSG_DELETED_ID + case MSG_DELETED_ID = "MSG_DELETED_ID" + + /// MSG_DUPLICATE_ID + case MSG_DUPLICATE_ID = "MSG_DUPLICATE_ID" + + /// MSG_ERROR_PARSING + case MSG_ERROR_PARSING = "MSG_ERROR_PARSING" + + /// MSG_ID_INVALID + case MSG_ID_INVALID = "MSG_ID_INVALID" + + /// MSG_ID_TOO_LONG + case MSG_ID_TOO_LONG = "MSG_ID_TOO_LONG" + + /// MSG_INVALID_ID + case MSG_INVALID_ID = "MSG_INVALID_ID" + + /// MSG_JSON_OBJECT + case MSG_JSON_OBJECT = "MSG_JSON_OBJECT" + + /// MSG_LOCAL_FAIL + case MSG_LOCAL_FAIL = "MSG_LOCAL_FAIL" + + /// MSG_NO_MATCH + case MSG_NO_MATCH = "MSG_NO_MATCH" + + /// MSG_NO_EXIST + case MSG_NO_EXIST = "MSG_NO_EXIST" + + /// MSG_NO_MODULE + case MSG_NO_MODULE = "MSG_NO_MODULE" + + /// MSG_NO_SUMMARY + case MSG_NO_SUMMARY = "MSG_NO_SUMMARY" + + /// MSG_OP_NOT_ALLOWED + case MSG_OP_NOT_ALLOWED = "MSG_OP_NOT_ALLOWED" + + /// MSG_PARAM_CHAINED + case MSG_PARAM_CHAINED = "MSG_PARAM_CHAINED" + + /// MSG_PARAM_NO_REPEAT + case MSG_PARAM_NO_REPEAT = "MSG_PARAM_NO_REPEAT" + + /// MSG_PARAM_UNKNOWN + case MSG_PARAM_UNKNOWN = "MSG_PARAM_UNKNOWN" + + /// MSG_PARAM_INVALID + case MSG_PARAM_INVALID = "MSG_PARAM_INVALID" + + /// MSG_PARAM_MODIFIER_INVALID + case MSG_PARAM_MODIFIER_INVALID = "MSG_PARAM_MODIFIER_INVALID" + + /// MSG_RESOURCE_EXAMPLE_PROTECTED + case MSG_RESOURCE_EXAMPLE_PROTECTED = "MSG_RESOURCE_EXAMPLE_PROTECTED" + + /// MSG_RESOURCE_ID_FAIL + case MSG_RESOURCE_ID_FAIL = "MSG_RESOURCE_ID_FAIL" + + /// MSG_RESOURCE_NOT_ALLOWED + case MSG_RESOURCE_NOT_ALLOWED = "MSG_RESOURCE_NOT_ALLOWED" + + /// MSG_RESOURCE_REQUIRED + case MSG_RESOURCE_REQUIRED = "MSG_RESOURCE_REQUIRED" + + /// MSG_RESOURCE_ID_MISMATCH + case MSG_RESOURCE_ID_MISMATCH = "MSG_RESOURCE_ID_MISMATCH" + + /// MSG_RESOURCE_ID_MISSING + case MSG_RESOURCE_ID_MISSING = "MSG_RESOURCE_ID_MISSING" + + /// MSG_RESOURCE_TYPE_MISMATCH + case MSG_RESOURCE_TYPE_MISMATCH = "MSG_RESOURCE_TYPE_MISMATCH" + + /// MSG_SORT_UNKNOWN + case MSG_SORT_UNKNOWN = "MSG_SORT_UNKNOWN" + + /// MSG_TRANSACTION_DUPLICATE_ID + case MSG_TRANSACTION_DUPLICATE_ID = "MSG_TRANSACTION_DUPLICATE_ID" + + /// MSG_TRANSACTION_MISSING_ID + case MSG_TRANSACTION_MISSING_ID = "MSG_TRANSACTION_MISSING_ID" + + /// MSG_UNHANDLED_NODE_TYPE + case MSG_UNHANDLED_NODE_TYPE = "MSG_UNHANDLED_NODE_TYPE" + + /// MSG_UNKNOWN_CONTENT + case MSG_UNKNOWN_CONTENT = "MSG_UNKNOWN_CONTENT" + + /// MSG_UNKNOWN_OPERATION + case MSG_UNKNOWN_OPERATION = "MSG_UNKNOWN_OPERATION" + + /// MSG_UNKNOWN_TYPE + case MSG_UNKNOWN_TYPE = "MSG_UNKNOWN_TYPE" + + /// MSG_UPDATED + case MSG_UPDATED = "MSG_UPDATED" + + /// MSG_VERSION_AWARE + case MSG_VERSION_AWARE = "MSG_VERSION_AWARE" + + /// MSG_VERSION_AWARE_CONFLICT + case MSG_VERSION_AWARE_CONFLICT = "MSG_VERSION_AWARE_CONFLICT" + + /// MSG_VERSION_AWARE_URL + case MSG_VERSION_AWARE_URL = "MSG_VERSION_AWARE_URL" + + /// MSG_WRONG_NS + case MSG_WRONG_NS = "MSG_WRONG_NS" + + /// SEARCH_MULTIPLE + case SEARCH_MULTIPLE = "SEARCH_MULTIPLE" + + /// UPDATE_MULTIPLE_MATCHES + case UPDATE_MULTIPLE_MATCHES = "UPDATE_MULTIPLE_MATCHES" + + /// DELETE_MULTIPLE_MATCHES + case DELETE_MULTIPLE_MATCHES = "DELETE_MULTIPLE_MATCHES" + + /// SEARCH_NONE + case SEARCH_NONE = "SEARCH_NONE" +} diff --git a/Sources/ModelsSTU3/CodeSystemOperationParameterUse.swift b/Sources/ModelsSTU3/CodeSystemOperationParameterUse.swift new file mode 100644 index 0000000..a496a50 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemOperationParameterUse.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Whether an operation parameter is an input or an output parameter. + + URL: http://hl7.org/fhir/operation-parameter-use + ValueSet: http://hl7.org/fhir/ValueSet/operation-parameter-use + */ +public enum OperationParameterUse: String, FHIRPrimitiveType { + + /// This is an input parameter. + case `in` = "in" + + /// This is an output parameter. + case out = "out" +} diff --git a/Sources/ModelsSTU3/CodeSystemParticipantRequired.swift b/Sources/ModelsSTU3/CodeSystemParticipantRequired.swift new file mode 100644 index 0000000..5f7f771 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemParticipantRequired.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Is the Participant required to attend the appointment. + + URL: http://hl7.org/fhir/participantrequired + ValueSet: http://hl7.org/fhir/ValueSet/participantrequired + */ +public enum ParticipantRequired: String, FHIRPrimitiveType { + + /// The participant is required to attend the appointment. + case required = "required" + + /// The participant may optionally attend the appointment. + case optional = "optional" + + /// The participant is excluded from the appointment, and may not be informed of the appointment taking place. + /// (Appointment is about them, not for them - such as 2 doctors discussing results about a patient's test). + case informationOnly = "information-only" +} diff --git a/Sources/ModelsSTU3/CodeSystemParticipationStatus.swift b/Sources/ModelsSTU3/CodeSystemParticipationStatus.swift new file mode 100644 index 0000000..79d8d36 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemParticipationStatus.swift @@ -0,0 +1,43 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The Participation status of an appointment. + + URL: http://hl7.org/fhir/participationstatus + ValueSet: http://hl7.org/fhir/ValueSet/participationstatus + */ +public enum ParticipationStatus: String, FHIRPrimitiveType { + + /// The participant has accepted the appointment. + case accepted = "accepted" + + /// The participant has declined the appointment and will not participate in the appointment. + case declined = "declined" + + /// The participant has tentatively accepted the appointment. This could be automatically created by a system and + /// requires further processing before it can be accepted. There is no commitment that attendance will occur. + case tentative = "tentative" + + /// The participant needs to indicate if they accept the appointment by changing this status to one of the other + /// statuses. + case needsAction = "needs-action" +} diff --git a/Sources/ModelsSTU3/CodeSystemPayeeResourceType.swift b/Sources/ModelsSTU3/CodeSystemPayeeResourceType.swift new file mode 100644 index 0000000..4a077ab --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemPayeeResourceType.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of payee Resource + + URL: http://hl7.org/fhir/resource-type-link + ValueSet: http://hl7.org/fhir/ValueSet/resource-type-link + */ +public enum PayeeResourceType: String, FHIRPrimitiveType { + + /// Organization resource + case organization = "organization" + + /// Patient resource + case patient = "patient" + + /// Practitioner resource + case practitioner = "practitioner" + + /// RelatedPerson resource + case relatedperson = "relatedperson" +} diff --git a/Sources/ModelsSTU3/CodeSystemPlanDefinitionType.swift b/Sources/ModelsSTU3/CodeSystemPlanDefinitionType.swift new file mode 100644 index 0000000..4e562ad --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemPlanDefinitionType.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of PlanDefinition + + URL: http://hl7.org/fhir/plan-definition-type + ValueSet: http://hl7.org/fhir/ValueSet/plan-definition-type + */ +public enum PlanDefinitionType: String, FHIRPrimitiveType { + + /// A pre-defined and approved group of orders related to a particular clinical condition (e.g. hypertension + /// treatment and monitoring) or stage of care (e.g. hospital admission to Coronary Care Unit). An order set is used + /// as a checklist for the clinician when managing a patient with a specific condition. It is a structured + /// collection of orders relevant to that condition and presented to the clinician in a computerized provider order + /// entry (CPOE) system + case orderSet = "order-set" + + /// A set of activities that can be performed that have relationships in terms of order, pre-conditions, etc. + case `protocol` = "protocol" + + /// A decision support rule of the form [on Event] if Condition then Action. It is intended to be a shareable, + /// computable definition of actions that should be taken whenever some condition is met in response to a particular + /// event or events + case ecaRule = "eca-rule" +} diff --git a/Sources/ModelsSTU3/CodeSystemPropertyRepresentation.swift b/Sources/ModelsSTU3/CodeSystemPropertyRepresentation.swift new file mode 100644 index 0000000..8ece4fb --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemPropertyRepresentation.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How a property is represented when serialized. + + URL: http://hl7.org/fhir/property-representation + ValueSet: http://hl7.org/fhir/ValueSet/property-representation + */ +public enum PropertyRepresentation: String, FHIRPrimitiveType { + + /// In XML, this property is represented as an attribute not an element. + case xmlAttr = "xmlAttr" + + /// This element is represented using the XML text attribute (primitives only) + case xmlText = "xmlText" + + /// The type of this element is indicated using xsi:type + case typeAttr = "typeAttr" + + /// Use CDA narrative instead of XHTML + case cdaText = "cdaText" + + /// The property is represented using XHTML + case xhtml = "xhtml" +} diff --git a/Sources/ModelsSTU3/CodeSystemPropertyType.swift b/Sources/ModelsSTU3/CodeSystemPropertyType.swift new file mode 100644 index 0000000..d55fbf3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemPropertyType.swift @@ -0,0 +1,49 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of a property value + + URL: http://hl7.org/fhir/concept-property-type + ValueSet: http://hl7.org/fhir/ValueSet/concept-property-type + */ +public enum PropertyType: String, FHIRPrimitiveType { + + /// The property value is a code that identifies a concept defined in the code system + case code = "code" + + /// The property value is a code defined in an external code system. This may be used for translations, but is not + /// the intent + case coding = "Coding" + + /// The property value is a string + case string = "string" + + /// The property value is a string (often used to assign ranking values to concepts for supporting score + /// assessments) + case integer = "integer" + + /// The property value is a boolean true | false + case boolean = "boolean" + + /// The property is a date or a date + time + case dateTime = "dateTime" +} diff --git a/Sources/ModelsSTU3/CodeSystemProvenanceEntityRole.swift b/Sources/ModelsSTU3/CodeSystemProvenanceEntityRole.swift new file mode 100644 index 0000000..d49f36b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemProvenanceEntityRole.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How an entity was used in an activity. + + URL: http://hl7.org/fhir/provenance-entity-role + ValueSet: http://hl7.org/fhir/ValueSet/provenance-entity-role + */ +public enum ProvenanceEntityRole: String, FHIRPrimitiveType { + + /// A transformation of an entity into another, an update of an entity resulting in a new one, or the construction + /// of a new entity based on a preexisting entity. + case derivation = "derivation" + + /// A derivation for which the resulting entity is a revised version of some original. + case revision = "revision" + + /// The repeat of (some or all of) an entity, such as text or image, by someone who may or may not be its original + /// author. + case quotation = "quotation" + + /// A primary source for a topic refers to something produced by some agent with direct experience and knowledge + /// about the topic, at the time of the topic's study, without benefit from hindsight. + case source = "source" + + /// A derivation for which the entity is removed from accessibility usually through the use of the Delete operation. + case removal = "removal" +} diff --git a/Sources/ModelsSTU3/CodeSystemPublicationStatus.swift b/Sources/ModelsSTU3/CodeSystemPublicationStatus.swift new file mode 100644 index 0000000..e80115b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemPublicationStatus.swift @@ -0,0 +1,43 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The lifecycle status of a Value Set or Concept Map. + + URL: http://hl7.org/fhir/publication-status + ValueSet: http://hl7.org/fhir/ValueSet/publication-status + */ +public enum PublicationStatus: String, FHIRPrimitiveType { + + /// This resource is still under development and is not yet considered to be ready for normal use. + case draft = "draft" + + /// This resource is ready for normal use. + case active = "active" + + /// This resource has been withdrawn or superseded and should no longer be used. + case retired = "retired" + + /// The authoring system does not know which of the status values currently applies for this resource. Note: This + /// concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known + /// which one. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemQualityOfEvidenceRating.swift b/Sources/ModelsSTU3/CodeSystemQualityOfEvidenceRating.swift new file mode 100644 index 0000000..04054be --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemQualityOfEvidenceRating.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A rating system that describes the quality of evidence such as the GRADE, DynaMed, or Oxford CEBM systems + + URL: http://hl7.org/fhir/evidence-quality + ValueSet: http://hl7.org/fhir/ValueSet/cqif-evidence-quality + */ +public enum QualityOfEvidenceRating: String, FHIRPrimitiveType { + + /// High quality evidence + case high = "high" + + /// Moderate quality evidence + case moderate = "moderate" + + /// Low quality evidence + case low = "low" + + /// Very low quality evidence + case veryLow = "very-low" +} diff --git a/Sources/ModelsSTU3/CodeSystemQualityType.swift b/Sources/ModelsSTU3/CodeSystemQualityType.swift new file mode 100644 index 0000000..0f21d35 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemQualityType.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Type for quality report + + URL: http://hl7.org/fhir/quality-type + ValueSet: http://hl7.org/fhir/ValueSet/quality-type + */ +public enum QualityType: String, FHIRPrimitiveType { + + /// INDEL Comparison + case indel = "indel" + + /// SNP Comparison + case snp = "snp" + + /// UNKNOWN Comparison + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemQuantityComparator.swift b/Sources/ModelsSTU3/CodeSystemQuantityComparator.swift new file mode 100644 index 0000000..8ed0e7a --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemQuantityComparator.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How the Quantity should be understood and represented. + + URL: http://hl7.org/fhir/quantity-comparator + ValueSet: http://hl7.org/fhir/ValueSet/quantity-comparator + */ +public enum QuantityComparator: String, FHIRPrimitiveType { + + /// The actual value is less than the given value. + case lt = "<" + + /// The actual value is less than or equal to the given value. + case lte = "<=" + + /// The actual value is greater than or equal to the given value. + case gte = ">=" + + /// The actual value is greater than the given value. + case gt = ">" +} diff --git a/Sources/ModelsSTU3/CodeSystemQuestionnaireItemType.swift b/Sources/ModelsSTU3/CodeSystemQuestionnaireItemType.swift new file mode 100644 index 0000000..60ebdb1 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemQuestionnaireItemType.swift @@ -0,0 +1,86 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Distinguishes groups from questions and display text and indicates data type for questions + + URL: http://hl7.org/fhir/item-type + ValueSet: http://hl7.org/fhir/ValueSet/item-type + */ +public enum QuestionnaireItemType: String, FHIRPrimitiveType { + + /// An item with no direct answer but should have at least one child item. + case group = "group" + + /// Text for display that will not capture an answer or have child items. + case display = "display" + + /// An item that defines a specific answer to be captured, and may have child items. + /// (the answer provided in the QuestionnaireResponse should be of the defined datatype) + case question = "question" + + /// Question with a yes/no answer (valueBoolean) + case boolean = "boolean" + + /// Question with is a real number answer (valueDecimal) + case decimal = "decimal" + + /// Question with an integer answer (valueInteger) + case integer = "integer" + + /// Question with a date answer (valueDate) + case date = "date" + + /// Question with a date and time answer (valueDateTime) + case dateTime = "dateTime" + + /// Question with a time (hour:minute:second) answer independent of date. (valueTime) + case time = "time" + + /// Question with a short (few words to short sentence) free-text entry answer (valueString) + case string = "string" + + /// Question with a long (potentially multi-paragraph) free-text entry answer (valueString) + case text = "text" + + /// Question with a URL (website, FTP site, etc.) answer (valueUri) + case url = "url" + + /// Question with a Coding drawn from a list of options (specified in either the option property, or via the + /// valueset referenced in the options property) as an answer (valueCoding) + case choice = "choice" + + /// Answer is a Coding drawn from a list of options (as with the choice type) or a free-text entry in a string + /// (valueCoding or valueString) + case openChoice = "open-choice" + + /// Question with binary content such as a image, PDF, etc. as an answer (valueAttachment) + case attachment = "attachment" + + /// Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference) + case reference = "reference" + + /// Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an + /// answer. (valueQuantity) + /// There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define + /// what unit whould be captured (or the a unit that has a ucum conversion from the provided unit) + case quantity = "quantity" +} diff --git a/Sources/ModelsSTU3/CodeSystemQuestionnaireItemUsageMode.swift b/Sources/ModelsSTU3/CodeSystemQuestionnaireItemUsageMode.swift new file mode 100644 index 0000000..4a6f72d --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemQuestionnaireItemUsageMode.swift @@ -0,0 +1,46 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Identifies the modes of usage of a questionnaire that should enable a particular questionnaire item + + URL: http://hl7.org/fhir/questionnaire-usage-mode + ValueSet: http://hl7.org/fhir/ValueSet/questionnaire-usage-mode + */ +public enum QuestionnaireItemUsageMode: String, FHIRPrimitiveType { + + /// Render the item regardless of usage mode + case captureDisplay = "capture-display" + + /// Render the item only when capturing data + case capture = "capture" + + /// Render the item only when displaying a completed form + case display = "display" + + /// Render the item only when displaying a completed form and the item has been answered (or has child items that + /// have been answered) + case displayNonEmpty = "display-non-empty" + + /// Render the item when capturing data or when displaying a completed form and the item has been answered (or has + /// child items that have been answered) + case captureDisplayNonEmpty = "capture-display-non-empty" +} diff --git a/Sources/ModelsSTU3/CodeSystemQuestionnaireResponseStatus.swift b/Sources/ModelsSTU3/CodeSystemQuestionnaireResponseStatus.swift new file mode 100644 index 0000000..47e21b1 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemQuestionnaireResponseStatus.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Lifecycle status of the questionnaire response. + + URL: http://hl7.org/fhir/questionnaire-answers-status + ValueSet: http://hl7.org/fhir/ValueSet/questionnaire-answers-status + */ +public enum QuestionnaireResponseStatus: String, FHIRPrimitiveType { + + /// This QuestionnaireResponse has been partially filled out with answers, but changes or additions are still + /// expected to be made to it. + case inProgress = "in-progress" + + /// This QuestionnaireResponse has been filled out with answers, and the current content is regarded as definitive. + case completed = "completed" + + /// This QuestionnaireResponse has been filled out with answers, then marked as complete, yet changes or additions + /// have been made to it afterwards. + case amended = "amended" + + /// This QuestionnaireResponse was entered in error and voided. + case enteredInError = "entered-in-error" + + /// This QuestionnaireResponse has been partially filled out with answers, but has been abandoned. It is unknown + /// whether changes or additions are expected to be made to it. + case stopped = "stopped" +} diff --git a/Sources/ModelsSTU3/CodeSystemReferenceHandlingPolicy.swift b/Sources/ModelsSTU3/CodeSystemReferenceHandlingPolicy.swift new file mode 100644 index 0000000..d37026f --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemReferenceHandlingPolicy.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A set of flags that defines how references are supported. + + URL: http://hl7.org/fhir/reference-handling-policy + ValueSet: http://hl7.org/fhir/ValueSet/reference-handling-policy + */ +public enum ReferenceHandlingPolicy: String, FHIRPrimitiveType { + + /// The server supports and populates Literal references where they are known (this code does not guarantee that all + /// references are literal; see 'enforced') + case literal = "literal" + + /// The server allows logical references + case logical = "logical" + + /// The server will attempt to resolve logical references to literal references (if resolution fails, the server may + /// still accept resources; see logical) + case resolves = "resolves" + + /// The server enforces that references have integrity - e.g. it ensures that references can always be resolved. + /// This is typically the case for clinical record systems, but often not the case for middleware/proxy systems + case enforced = "enforced" + + /// The server does not support references that point to other servers + case local = "local" +} diff --git a/Sources/ModelsSTU3/CodeSystemReferenceVersionRules.swift b/Sources/ModelsSTU3/CodeSystemReferenceVersionRules.swift new file mode 100644 index 0000000..d677c58 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemReferenceVersionRules.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Whether a reference needs to be version specific or version independent, or whether either can be used + + URL: http://hl7.org/fhir/reference-version-rules + ValueSet: http://hl7.org/fhir/ValueSet/reference-version-rules + */ +public enum ReferenceVersionRules: String, FHIRPrimitiveType { + + /// The reference may be either version independent or version specific + case either = "either" + + /// The reference must be version independent + case independent = "independent" + + /// The reference must be version specific + case specific = "specific" +} diff --git a/Sources/ModelsSTU3/CodeSystemReferralMethod.swift b/Sources/ModelsSTU3/CodeSystemReferralMethod.swift new file mode 100644 index 0000000..6df0709 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemReferralMethod.swift @@ -0,0 +1,46 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The methods of referral can be used when referring to a specific HealthCareService resource. + + URL: http://hl7.org/fhir/service-referral-method + ValueSet: http://hl7.org/fhir/ValueSet/service-referral-method + */ +public enum ReferralMethod: String, FHIRPrimitiveType { + + /// Referrals may be accepted by fax. + case fax = "fax" + + /// Referrals may be accepted over the phone from a practitioner. + case phone = "phone" + + /// Referrals may be accepted via a secure messaging system. To determine the types of secure messaging systems + /// supported, refer to the identifiers collection. Callers will need to understand the specific identifier system + /// used to know that they are able to transmit messages. + case elec = "elec" + + /// Referrals may be accepted via a secure email. To send please encrypt with the services public key. + case semail = "semail" + + /// Referrals may be accepted via regular postage (or hand delivered). + case mail = "mail" +} diff --git a/Sources/ModelsSTU3/CodeSystemRelatedArtifactType.swift b/Sources/ModelsSTU3/CodeSystemRelatedArtifactType.swift new file mode 100644 index 0000000..55b55ba --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemRelatedArtifactType.swift @@ -0,0 +1,62 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of relationship to the related artifact + + URL: http://hl7.org/fhir/related-artifact-type + ValueSet: http://hl7.org/fhir/ValueSet/related-artifact-type + */ +public enum RelatedArtifactType: String, FHIRPrimitiveType { + + /// Additional documentation for the knowledge resource. This would include additional instructions on usage as well + /// as additional information on clinical context or appropriateness + case documentation = "documentation" + + /// A summary of the justification for the knowledge resource including supporting evidence, relevant guidelines, or + /// other clinically important information. This information is intended to provide a way to make the justification + /// for the knowledge resource available to the consumer of interventions or results produced by the knowledge + /// resource + case justification = "justification" + + /// Bibliographic citation for papers, references, or other relevant material for the knowledge resource. This is + /// intended to allow for citation of related material, but that was not necessarily specifically prepared in + /// connection with this knowledge resource + case citation = "citation" + + /// The previous version of the knowledge resource + case predecessor = "predecessor" + + /// The next version of the knowledge resource + case successor = "successor" + + /// The knowledge resource is derived from the related artifact. This is intended to capture the relationship in + /// which a particular knowledge resource is based on the content of another artifact, but is modified to capture + /// either a different set of overall requirements, or a more specific set of requirements such as those involved in + /// a particular institution or clinical setting + case derivedFrom = "derived-from" + + /// The knowledge resource depends on the given related artifact + case dependsOn = "depends-on" + + /// The knowledge resource is composed of the given related artifact + case composedOf = "composed-of" +} diff --git a/Sources/ModelsSTU3/CodeSystemRepositoryType.swift b/Sources/ModelsSTU3/CodeSystemRepositoryType.swift new file mode 100644 index 0000000..e5dc3a8 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemRepositoryType.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Type for access of external URI + + URL: http://hl7.org/fhir/repository-type + ValueSet: http://hl7.org/fhir/ValueSet/repository-type + */ +public enum RepositoryType: String, FHIRPrimitiveType { + + /// When URL is clicked, the resource can be seen directly (by webpage or by download link format) + case directlink = "directlink" + + /// When the API method (e.g. [base_url]/[parameter]) related with the URL of the website is executed, the resource + /// can be seen directly (usually in JSON or XML format) + case openapi = "openapi" + + /// When logged into the website, the resource can be seen. + case login = "login" + + /// When logged in and follow the API in the website related with URL, the resource can be seen. + case oauth = "oauth" + + /// Some other complicated or particular way to get resource from URL. + case other = "other" +} diff --git a/Sources/ModelsSTU3/CodeSystemRequestIntent.swift b/Sources/ModelsSTU3/CodeSystemRequestIntent.swift new file mode 100644 index 0000000..d4f61b8 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemRequestIntent.swift @@ -0,0 +1,61 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes indicating the degree of authority/intentionality associated with a request + + URL: http://hl7.org/fhir/request-intent + ValueSet: http://hl7.org/fhir/ValueSet/request-intent + */ +public enum RequestIntent: String, FHIRPrimitiveType { + + /// The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and + /// without providing an authorization to act + case proposal = "proposal" + + /// The request represents an intension to ensure something occurs without providing an authorization for others to + /// act + case plan = "plan" + + /// The request represents a request/demand and authorization for action + case order = "order" + + /// The request represents an original authorization for action + case originalOrder = "original-order" + + /// The request represents an automatically generated supplemental authorization for action based on a parent + /// authorization together with initial results of the action taken against that parent authorization + case reflexOrder = "reflex-order" + + /// The request represents the view of an authorization instantiated by a fulfilling system representing the details + /// of the fulfiller's intention to act upon a submitted order + case fillerOrder = "filler-order" + + /// An order created in fulfillment of a broader order that represents the authorization for a single activity + /// occurrence. E.g. The administration of a single dose of a drug. + case instanceOrder = "instance-order" + + /// The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or + /// other constraints among a set of requests. + /// + /// Refer to [[[RequestGroup]]] for additional information on how this status is used + case option = "option" +} diff --git a/Sources/ModelsSTU3/CodeSystemRequestPriority.swift b/Sources/ModelsSTU3/CodeSystemRequestPriority.swift new file mode 100644 index 0000000..f94cff6 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemRequestPriority.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Identifies the level of importance to be assigned to actioning the request + + URL: http://hl7.org/fhir/request-priority + ValueSet: http://hl7.org/fhir/ValueSet/request-priority + */ +public enum RequestPriority: String, FHIRPrimitiveType { + + /// The request has normal priority + case routine = "routine" + + /// The request should be actioned promptly - higher priority than routine + case urgent = "urgent" + + /// The request should be actioned as soon as possible - higher priority than urgent + case asap = "asap" + + /// The request should be actioned immediately - highest possible priority. E.g. an emergency + case stat = "stat" +} diff --git a/Sources/ModelsSTU3/CodeSystemRequestStatus.swift b/Sources/ModelsSTU3/CodeSystemRequestStatus.swift new file mode 100644 index 0000000..43c6510 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemRequestStatus.swift @@ -0,0 +1,54 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes identifying the stage lifecycle stage of a request + + URL: http://hl7.org/fhir/request-status + ValueSet: http://hl7.org/fhir/ValueSet/request-status + */ +public enum RequestStatus: String, FHIRPrimitiveType { + + /// The request has been created but is not yet complete or ready for action + case draft = "draft" + + /// The request is ready to be acted upon + case active = "active" + + /// The authorization/request to act has been temporarily withdrawn but is expected to resume in the future + case suspended = "suspended" + + /// The authorization/request to act has been terminated prior to the full completion of the intended actions. No + /// further activity should occur. + case cancelled = "cancelled" + + /// Activity against the request has been sufficiently completed to the satisfaction of the requester + case completed = "completed" + + /// This electronic record should never have existed, though it is possible that real-world decisions were based on + /// it. (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".) + case enteredInError = "entered-in-error" + + /// The authoring system does not know which of the status values currently applies for this request. Note: This + /// concept is not to be used for "other" . One of the listed statuses is presumed to apply, but the system + /// creating the request doesn't know. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemResearchStudyStatus.swift b/Sources/ModelsSTU3/CodeSystemResearchStudyStatus.swift new file mode 100644 index 0000000..cc0e743 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemResearchStudyStatus.swift @@ -0,0 +1,48 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes that convey the current status of the research study + + URL: http://hl7.org/fhir/research-study-status + ValueSet: http://hl7.org/fhir/ValueSet/research-study-status + */ +public enum ResearchStudyStatus: String, FHIRPrimitiveType { + + /// The study is undergoing design but the process of selecting study subjects and capturing data has not yet begun. + case draft = "draft" + + /// The study is currently being executed + case inProgress = "in-progress" + + /// Execution of the study has been temporarily paused + case suspended = "suspended" + + /// The study was terminated prior to the final determination of results + case stopped = "stopped" + + /// The information sought by the study has been gathered and compiled and no further work is being performed + case completed = "completed" + + /// This study never actually existed. The record is retained for tracking purposes in the event decisions may have + /// been made based on this erroneous information. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemResearchSubjectStatus.swift b/Sources/ModelsSTU3/CodeSystemResearchSubjectStatus.swift new file mode 100644 index 0000000..0b5df27 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemResearchSubjectStatus.swift @@ -0,0 +1,49 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Indicates the progression of a study subject through a study + + URL: http://hl7.org/fhir/research-subject-status + ValueSet: http://hl7.org/fhir/ValueSet/research-subject-status + */ +public enum ResearchSubjectStatus: String, FHIRPrimitiveType { + + /// The subject has been identified as a potential participant in the study but has not yet agreed to participate + case candidate = "candidate" + + /// The subject has agreed to participate in the study but has not yet begun performing any action within the study + case enrolled = "enrolled" + + /// The subject is currently being monitored and/or subject to treatment as part of the study + case active = "active" + + /// The subject has temporarily discontinued monitoring/treatment as part of the study + case suspended = "suspended" + + /// The subject has permanently ended participation in the study prior to completion of the intended + /// monitoring/treatment + case withdrawn = "withdrawn" + + /// All intended monitoring/treatment of the subject has been completed and their engagement with the study is now + /// ended + case completed = "completed" +} diff --git a/Sources/ModelsSTU3/CodeSystemResourceType.swift b/Sources/ModelsSTU3/CodeSystemResourceType.swift new file mode 100644 index 0000000..a1bbc9c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemResourceType.swift @@ -0,0 +1,513 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + One of the resource types defined as part of FHIR. + + URL: http://hl7.org/fhir/resource-types + ValueSet: http://hl7.org/fhir/ValueSet/resource-types + */ +public enum ResourceType: String, FHIRPrimitiveType { + + /// A financial tool for tracking value accrued for a particular purpose. In the healthcare field, used to track + /// charges for a patient, cost centers, etc. + case account = "Account" + + /// This resource allows for the definition of some activity to be performed, independent of a particular patient, + /// practitioner, or other performance context. + case activityDefinition = "ActivityDefinition" + + /// Actual or potential/avoided event causing unintended physical injury resulting from or contributed to by + /// medical care, a research study or other healthcare setting factors that requires additional monitoring, + /// treatment, or hospitalization, or that results in death. + case adverseEvent = "AdverseEvent" + + /// Risk of harmful or undesirable, physiological response which is unique to an individual and associated with + /// exposure to a substance. + case allergyIntolerance = "AllergyIntolerance" + + /// A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a + /// specific date/time. This may result in one or more Encounter(s). + case appointment = "Appointment" + + /// A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection. + case appointmentResponse = "AppointmentResponse" + + /// A record of an event made for purposes of maintaining a security log. Typical uses include detection of + /// intrusion attempts and monitoring for inappropriate usage. + case auditEvent = "AuditEvent" + + /// Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an + /// existing resource, and custom resources not appropriate for inclusion in the FHIR specification. + case basic = "Basic" + + /// A binary resource can contain any content, whether text, image, pdf, zip archive, etc. + case binary = "Binary" + + /// Record details about the anatomical location of a specimen or body part. This resource may be used when a coded + /// concept does not provide the necessary detail needed for the use case. + case bodySite = "BodySite" + + /// A container for a collection of resources. + case bundle = "Bundle" + + /// A Capability Statement documents a set of capabilities (behaviors) of a FHIR Server that may be used as a + /// statement of actual server functionality or a statement of required or desired server implementation. + case capabilityStatement = "CapabilityStatement" + + /// Describes the intention of how one or more practitioners intend to deliver care for a particular patient, group + /// or community for a period of time, possibly limited to care for a specific condition or set of conditions. + case carePlan = "CarePlan" + + /// The Care Team includes all the people and organizations who plan to participate in the coordination and delivery + /// of care for a patient. + case careTeam = "CareTeam" + + /// The resource ChargeItem describes the provision of healthcare provider products for a certain patient, therefore + /// referring not only to the product, but containing in addition details of the provision, like date, time, amounts + /// and participating organizations and persons. Main Usage of the ChargeItem is to enable the billing process and + /// internal cost allocation. + case chargeItem = "ChargeItem" + + /// A provider issued list of services and products provided, or to be provided, to a patient which is provided to + /// an insurer for payment recovery. + case claim = "Claim" + + /// This resource provides the adjudication details from the processing of a Claim resource. + case claimResponse = "ClaimResponse" + + /// A record of a clinical assessment performed to determine what problem(s) may affect the patient and before + /// planning the treatments or management strategies that are best to manage a patient's condition. Assessments are + /// often 1:1 with a clinical consultation / encounter, but this varies greatly depending on the clinical workflow. + /// This resource is called "ClinicalImpression" rather than "ClinicalAssessment" to avoid confusion with the + /// recording of assessment tools such as Apgar score. + case clinicalImpression = "ClinicalImpression" + + /// A code system resource specifies a set of codes drawn from one or more code systems. + case codeSystem = "CodeSystem" + + /// An occurrence of information being transmitted; e.g. an alert that was sent to a responsible provider, a public + /// health agency was notified about a reportable condition. + case communication = "Communication" + + /// A request to convey information; e.g. the CDS system proposes that an alert be sent to a responsible provider, + /// the CDS system proposes that the public health agency be notified about a reportable condition. + case communicationRequest = "CommunicationRequest" + + /// A compartment definition that defines how resources are accessed on a server. + case compartmentDefinition = "CompartmentDefinition" + + /// A set of healthcare-related information that is assembled together into a single logical document that provides + /// a single coherent statement of meaning, establishes its own context and that has clinical attestation with + /// regard to who is making the statement. While a Composition defines the structure, it does not actually contain + /// the content: rather the full content of a document is contained in a Bundle, of which the Composition is the + /// first resource contained. + case composition = "Composition" + + /// A statement of relationships from one set of concepts to one or more other concepts - either code systems or + /// data elements, or classes in class models. + case conceptMap = "ConceptMap" + + /// A clinical condition, problem, diagnosis, or other event, situation, issue, or clinical concept that has risen + /// to a level of concern. + case condition = "Condition" + + /// A record of a healthcare consumer’s policy choices, which permits or denies identified recipient(s) or recipient + /// role(s) to perform one or more actions within a given policy context, for specific purposes and periods of time. + case consent = "Consent" + + /// A formal agreement between parties regarding the conduct of business, exchange of information or other matters. + case contract = "Contract" + + /// Financial instrument which may be used to reimburse or pay for health care products and services. + case coverage = "Coverage" + + /// The formal description of a single piece of information that can be gathered and reported. + case dataElement = "DataElement" + + /// Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions + /// for a patient; e.g. Drug-drug interaction, Ineffective treatment frequency, Procedure-condition conflict, etc. + case detectedIssue = "DetectedIssue" + + /// This resource identifies an instance or a type of a manufactured item that is used in the provision of + /// healthcare without being substantially changed through that activity. The device may be a medical or non-medical + /// device. Medical devices include durable (reusable) medical equipment, implantable devices, as well as + /// disposable equipment used for diagnostic, treatment, and research for healthcare and public health. Non-medical + /// devices may include items such as a machine, cellphone, computer, application, etc. + case device = "Device" + + /// The characteristics, operational status and capabilities of a medical-related component of a medical device. + case deviceComponent = "DeviceComponent" + + /// Describes a measurement, calculation or setting capability of a medical device. + case deviceMetric = "DeviceMetric" + + /// Represents a request for a patient to employ a medical device. The device may be an implantable device, or an + /// external assistive device, such as a walker. + case deviceRequest = "DeviceRequest" + + /// A record of a device being used by a patient where the record is the result of a report from the patient or + /// another clinician. + case deviceUseStatement = "DeviceUseStatement" + + /// The findings and interpretation of diagnostic tests performed on patients, groups of patients, devices, and + /// locations, and/or specimens derived from these. The report includes clinical context such as requesting and + /// provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted + /// representation of diagnostic reports. + case diagnosticReport = "DiagnosticReport" + + /// A collection of documents compiled for a purpose together with metadata that applies to the collection. + case documentManifest = "DocumentManifest" + + /// A reference to a document. + case documentReference = "DocumentReference" + + /// A resource that includes narrative, extensions, and contained resources. + case domainResource = "DomainResource" + + /// The EligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in + /// the form of an EligibilityResponse, with information regarding whether the stated coverage is valid and in-force + /// and optionally to provide the insurance details of the policy. + case eligibilityRequest = "EligibilityRequest" + + /// This resource provides eligibility and plan details from the processing of an Eligibility resource. + case eligibilityResponse = "EligibilityResponse" + + /// An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) + /// or assessing the health status of a patient. + case encounter = "Encounter" + + /// The technical details of an endpoint that can be used for electronic services, such as for web services + /// providing XDS.b or a REST endpoint for another FHIR server. This may include any security context information. + case endpoint = "Endpoint" + + /// This resource provides the insurance enrollment details to the insurer regarding a specified coverage. + case enrollmentRequest = "EnrollmentRequest" + + /// This resource provides enrollment and plan details from the processing of an Enrollment resource. + case enrollmentResponse = "EnrollmentResponse" + + /// An association between a patient and an organization / healthcare provider(s) during which time encounters may + /// occur. The managing organization assumes a level of responsibility for the patient during this time. + case episodeOfCare = "EpisodeOfCare" + + /// Resource to define constraints on the Expansion of a FHIR ValueSet. + case expansionProfile = "ExpansionProfile" + + /// This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally + /// account balance information, for informing the subscriber of the benefits provided. + case explanationOfBenefit = "ExplanationOfBenefit" + + /// Significant health events and conditions for a person related to the patient relevant in the context of care for + /// the patient. + case familyMemberHistory = "FamilyMemberHistory" + + /// Prospective warnings of potential issues when providing care to the patient. + case flag = "Flag" + + /// Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, + /// restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement + /// objective, etc. + case goal = "Goal" + + /// A formal computable definition of a graph of resources - that is, a coherent set of resources that form a graph + /// by following references. The Graph Definition resource defines a set and makes rules about the set. + case graphDefinition = "GraphDefinition" + + /// Represents a defined collection of entities that may be discussed or acted upon collectively but which are not + /// expected to act collectively and are not formally or legally recognized; i.e. a collection of entities that + /// isn't an Organization. + case group = "Group" + + /// A guidance response is the formal response to a guidance request, including any output parameters returned by + /// the evaluation, as well as the description of any proposed actions to be taken. + case guidanceResponse = "GuidanceResponse" + + /// The details of a healthcare service available at a location. + case healthcareService = "HealthcareService" + + /// A text description of the DICOM SOP instances selected in the ImagingManifest; or the reason for, or + /// significance of, the selection. + case imagingManifest = "ImagingManifest" + + /// Representation of the content produced in a DICOM imaging study. A study comprises a set of series, each of + /// which includes a set of Service-Object Pair Instances (SOP Instances - images or other data) acquired or + /// produced in a common context. A series is of only one modality (e.g. X-ray, CT, MR, ultrasound), but a study + /// may have multiple series of different modalities. + case imagingStudy = "ImagingStudy" + + /// Describes the event of a patient being administered a vaccination or a record of a vaccination as reported by a + /// patient, a clinician or another party and may include vaccine reaction information and what vaccination protocol + /// was followed. + case immunization = "Immunization" + + /// A patient's point-in-time immunization and recommendation (i.e. forecasting a patient's immunization eligibility + /// according to a published schedule) with optional supporting justification. + case immunizationRecommendation = "ImmunizationRecommendation" + + /// A set of rules of how FHIR is used to solve a particular problem. This resource is used to gather all the parts + /// of an implementation guide into a logical whole and to publish a computable definition of all the parts. + case implementationGuide = "ImplementationGuide" + + /// The Library resource is a general-purpose container for knowledge asset definitions. It can be used to describe + /// and expose existing knowledge assets such as logic libraries and information model descriptions, as well as to + /// describe a collection of knowledge assets. + case library = "Library" + + /// Identifies two or more records (resource instances) that are referring to the same real-world "occurrence". + case linkage = "Linkage" + + /// A set of information summarized from a list of other resources. + case list = "List" + + /// Details and position information for a physical place where services are provided and resources and + /// participants may be stored, found, contained or accommodated. + case location = "Location" + + /// The Measure resource provides the definition of a quality measure. + case measure = "Measure" + + /// The MeasureReport resource contains the results of evaluating a measure. + case measureReport = "MeasureReport" + + /// A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided + /// by direct reference. + case media = "Media" + + /// This resource is primarily used for the identification and definition of a medication. It covers the ingredients + /// and the packaging for a medication. + case medication = "Medication" + + /// Describes the event of a patient consuming or otherwise being administered a medication. This may be as simple + /// as swallowing a tablet or it may be a long running infusion. Related resources tie this event to the + /// authorizing prescription, and the specific encounter between patient and health care practitioner. + case medicationAdministration = "MedicationAdministration" + + /// Indicates that a medication product is to be or has been dispensed for a named person/patient. This includes a + /// description of the medication product (supply) provided and the instructions for administering the medication. + /// The medication dispense is the result of a pharmacy system responding to a medication order. + case medicationDispense = "MedicationDispense" + + /// An order or request for both supply of the medication and the instructions for administration of the medication + /// to a patient. The resource is called "MedicationRequest" rather than "MedicationPrescription" or + /// "MedicationOrder" to generalize the use across inpatient and outpatient settings, including care plans, etc., + /// and to harmonize with workflow patterns. + case medicationRequest = "MedicationRequest" + + /// A record of a medication that is being consumed by a patient. A MedicationStatement may indicate that the + /// patient may be taking the medication now, or has taken the medication in the past or will be taking the + /// medication in the future. The source of this information can be the patient, significant other (such as a + /// family member or spouse), or a clinician. A common scenario where this information is captured is during the + /// history taking process during a patient visit or stay. The medication information may come from sources such + /// as the patient's memory, from a prescription bottle, or from a list of medications the patient, clinician or + /// other party maintains + /// + /// The primary difference between a medication statement and a medication administration is that the medication + /// administration has complete administration information and is based on actual administration information from + /// the person who administered the medication. A medication statement is often, if not always, less specific. + /// There is no required date/time when the medication was administered, in fact we only know that a source has + /// reported the patient is taking this medication, where details such as time, quantity, or rate or even medication + /// product may be incomplete or missing or less precise. As stated earlier, the medication statement information + /// may come from the patient's memory, from a prescription bottle or from a list of medications the patient, + /// clinician or other party maintains. Medication administration is more formal and is not missing detailed + /// information. + case medicationStatement = "MedicationStatement" + + /// Defines the characteristics of a message that can be shared between systems, including the type of event that + /// initiates the message, the content to be transmitted and what response(s), if any, are permitted. + case messageDefinition = "MessageDefinition" + + /// The header for a message exchange that is either requesting or responding to an action. The reference(s) that + /// are the subject of the action as well as other information related to the action are typically transmitted in a + /// bundle in which the MessageHeader resource instance is the first resource in the bundle. + case messageHeader = "MessageHeader" + + /// A curated namespace that issues unique symbols within that namespace for the identification of concepts, people, + /// devices, etc. Represents a "System" used within the Identifier and Coding data types. + case namingSystem = "NamingSystem" + + /// A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident. + case nutritionOrder = "NutritionOrder" + + /// Measurements and simple assertions made about a patient, device or other subject. + case observation = "Observation" + + /// A formal computable definition of an operation (on the RESTful interface) or a named query (using the search + /// interaction). + case operationDefinition = "OperationDefinition" + + /// A collection of error, warning or information messages that result from a system action. + case operationOutcome = "OperationOutcome" + + /// A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some + /// form of collective action. Includes companies, institutions, corporations, departments, community groups, + /// healthcare practice groups, etc. + case organization = "Organization" + + /// This special resource type is used to represent an operation request and response (operations.html). It has no + /// other use, and there is no RESTful endpoint associated with it. + case parameters = "Parameters" + + /// Demographics and other administrative information about an individual or animal receiving care or other health- + /// related services. + case patient = "Patient" + + /// This resource provides the status of the payment for goods and services rendered, and the request and response + /// resource references. + case paymentNotice = "PaymentNotice" + + /// This resource provides payment details and claim references supporting a bulk payment. + case paymentReconciliation = "PaymentReconciliation" + + /// Demographics and administrative information about a person independent of a specific health-related context. + case person = "Person" + + /// This resource allows for the definition of various types of plans as a sharable, consumable, and executable + /// artifact. The resource is general enough to support the description of a broad range of clinical artifacts such + /// as clinical decision support rules, order sets and protocols. + case planDefinition = "PlanDefinition" + + /// A person who is directly or indirectly involved in the provisioning of healthcare. + case practitioner = "Practitioner" + + /// A specific set of Roles/Locations/specialties/services that a practitioner may perform at an organization for a + /// period of time. + case practitionerRole = "PractitionerRole" + + /// An action that is or was performed on a patient. This can be a physical intervention like an operation, or less + /// invasive like counseling or hypnotherapy. + case procedure = "Procedure" + + /// A record of a request for diagnostic investigations, treatments, or operations to be performed. + case procedureRequest = "ProcedureRequest" + + /// This resource provides the target, request and response, and action details for an action to be performed by the + /// target on or about existing resources. + case processRequest = "ProcessRequest" + + /// This resource provides processing status, errors and notes from the processing of a resource. + case processResponse = "ProcessResponse" + + /// Provenance of a resource is a record that describes entities and processes involved in producing and delivering + /// or otherwise influencing that resource. Provenance provides a critical foundation for assessing authenticity, + /// enabling trust, and allowing reproducibility. Provenance assertions are a form of contextual metadata and can + /// themselves become important records with their own provenance. Provenance statement indicates clinical + /// significance in terms of confidence in authenticity, reliability, and trustworthiness, integrity, and stage in + /// lifecycle (e.g. Document Completion - has the artifact been legally authenticated), all of which may impact + /// security, privacy, and trust policies. + case provenance = "Provenance" + + /// A structured set of questions intended to guide the collection of answers from end-users. Questionnaires provide + /// detailed control over order, presentation, phraseology and grouping to allow coherent, consistent data + /// collection. + case questionnaire = "Questionnaire" + + /// A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, + /// corresponding to the structure of the grouping of the questionnaire being responded to. + case questionnaireResponse = "QuestionnaireResponse" + + /// Used to record and send details about a request for referral service or transfer of a patient to the care of + /// another provider or provider organization. + case referralRequest = "ReferralRequest" + + /// Information about a person that is involved in the care for a patient, but who is not the target of healthcare, + /// nor has a formal responsibility in the care process. + case relatedPerson = "RelatedPerson" + + /// A group of related requests that can be used to capture intended activities that have inter-dependencies such as + /// "give this medication after that one". + case requestGroup = "RequestGroup" + + /// A process where a researcher or organization plans and then executes a series of steps intended to increase the + /// field of healthcare-related knowledge. This includes studies of safety, efficacy, comparative effectiveness and + /// other information about medications, devices, therapies and other interventional and investigative techniques. + /// A ResearchStudy involves the gathering of information about human or animal subjects. + case researchStudy = "ResearchStudy" + + /// A process where a researcher or organization plans and then executes a series of steps intended to increase the + /// field of healthcare-related knowledge. This includes studies of safety, efficacy, comparative effectiveness and + /// other information about medications, devices, therapies and other interventional and investigative techniques. + /// A ResearchStudy involves the gathering of information about human or animal subjects. + case researchSubject = "ResearchSubject" + + /// This is the base resource type for everything. + case resource = "Resource" + + /// An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome. + case riskAssessment = "RiskAssessment" + + /// A container for slots of time that may be available for booking appointments. + case schedule = "Schedule" + + /// A search parameter that defines a named search item that can be used to search/filter on a resource. + case searchParameter = "SearchParameter" + + /// Raw data describing a biological sequence. + case sequence = "Sequence" + + /// The ServiceDefinition describes a unit of decision support functionality that is made available as a service, + /// such as immunization modules or drug-drug interaction checking. + case serviceDefinition = "ServiceDefinition" + + /// A slot of time on a schedule that may be available for booking appointments. + case slot = "Slot" + + /// A sample to be used for analysis. + case specimen = "Specimen" + + /// A definition of a FHIR structure. This resource is used to describe the underlying resources, data types defined + /// in FHIR, and also for describing extensions and constraints on resources and data types. + case structureDefinition = "StructureDefinition" + + /// A Map of relationships between 2 structures that can be used to transform data. + case structureMap = "StructureMap" + + /// The subscription resource is used to define a push based subscription from a server to another system. Once a + /// subscription is registered with the server, the server checks every resource that is created or updated, and if + /// the resource matches the given criteria, it sends a message on the defined "channel" so that another system is + /// able to take an appropriate action. + case subscription = "Subscription" + + /// A homogeneous material with a definite composition. + case substance = "Substance" + + /// Record of delivery of what is supplied. + case supplyDelivery = "SupplyDelivery" + + /// A record of a request for a medication, substance or device used in the healthcare setting. + case supplyRequest = "SupplyRequest" + + /// A task to be performed. + case task = "Task" + + /// A summary of information based on the results of executing a TestScript. + case testReport = "TestReport" + + /// A structured set of tests against a FHIR server implementation to determine compliance against the FHIR + /// specification. + case testScript = "TestScript" + + /// A value set specifies a set of codes drawn from one or more code systems. + case valueSet = "ValueSet" + + /// An authorization for the supply of glasses and/or contact lenses to a patient. + case visionPrescription = "VisionPrescription" +} diff --git a/Sources/ModelsSTU3/CodeSystemResourceValidationMode.swift b/Sources/ModelsSTU3/CodeSystemResourceValidationMode.swift new file mode 100644 index 0000000..c0e068d --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemResourceValidationMode.swift @@ -0,0 +1,42 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes indicating the type of validation to perform + + URL: http://hl7.org/fhir/resource-validation-mode + ValueSet: http://hl7.org/fhir/ValueSet/resource-validation-mode + */ +public enum ResourceValidationMode: String, FHIRPrimitiveType { + + /// The server checks the content, and then checks that the content would be acceptable as a create (e.g. that the + /// content would not violate any uniqueness constraints). + case create = "create" + + /// The server checks the content, and then checks that it would accept it as an update against the nominated + /// specific resource (e.g. that there are no changes to immutable fields the server does not allow to change, and + /// checking version integrity if appropriate). + case update = "update" + + /// The server ignores the content, and checks that the nominated resource is allowed to be deleted (e.g. checking + /// referential integrity rules). + case delete = "delete" +} diff --git a/Sources/ModelsSTU3/CodeSystemResourceVersionPolicy.swift b/Sources/ModelsSTU3/CodeSystemResourceVersionPolicy.swift new file mode 100644 index 0000000..dc4dba1 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemResourceVersionPolicy.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How the system supports versioning for a resource. + + URL: http://hl7.org/fhir/versioning-policy + ValueSet: http://hl7.org/fhir/ValueSet/versioning-policy + */ +public enum ResourceVersionPolicy: String, FHIRPrimitiveType { + + /// VersionId meta-property is not supported (server) or used (client). + case noVersion = "no-version" + + /// VersionId meta-property is supported (server) or used (client). + case versioned = "versioned" + + /// VersionId must be correct for updates (server) or will be specified (If-match header) for updates (client). + case versionedUpdate = "versioned-update" +} diff --git a/Sources/ModelsSTU3/CodeSystemResponseType.swift b/Sources/ModelsSTU3/CodeSystemResponseType.swift new file mode 100644 index 0000000..f2552d4 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemResponseType.swift @@ -0,0 +1,40 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The kind of response to a message + + URL: http://hl7.org/fhir/response-code + ValueSet: http://hl7.org/fhir/ValueSet/response-code + */ +public enum ResponseType: String, FHIRPrimitiveType { + + /// The message was accepted and processed without error. + case ok = "ok" + + /// Some internal unexpected error occurred - wait and try again. Note - this is usually used for things like + /// database unavailable, which may be expected to resolve, though human intervention may be required. + case transientError = "transient-error" + + /// The message was rejected because of a problem with the content. There is no point in re-sending without change. + /// The response narrative SHALL describe the issue. + case fatalError = "fatal-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemRestfulCapabilityMode.swift b/Sources/ModelsSTU3/CodeSystemRestfulCapabilityMode.swift new file mode 100644 index 0000000..7a075b4 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemRestfulCapabilityMode.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The mode of a RESTful capability statement. + + URL: http://hl7.org/fhir/restful-capability-mode + ValueSet: http://hl7.org/fhir/ValueSet/restful-capability-mode + */ +public enum RestfulCapabilityMode: String, FHIRPrimitiveType { + + /// The application acts as a client for this resource. + case client = "client" + + /// The application acts as a server for this resource. + case server = "server" +} diff --git a/Sources/ModelsSTU3/CodeSystemRestfulSecurityService.swift b/Sources/ModelsSTU3/CodeSystemRestfulSecurityService.swift new file mode 100644 index 0000000..7728975 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemRestfulSecurityService.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Types of security services used with FHIR. + + URL: http://hl7.org/fhir/restful-security-service + ValueSet: http://hl7.org/fhir/ValueSet/restful-security-service + */ +public enum RestfulSecurityService: String, FHIRPrimitiveType { + + /// Oauth (unspecified version see oauth.net). + case oAuth = "OAuth" + + /// OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org/). + case sMARTOnFHIR = "SMART-on-FHIR" + + /// Microsoft NTLM Authentication. + case NTLM = "NTLM" + + /// Basic authentication defined in HTTP specification. + case basic = "Basic" + + /// see http://www.ietf.org/rfc/rfc4120.txt. + case kerberos = "Kerberos" + + /// SSL where client must have a certificate registered with the server. + case certificates = "Certificates" +} diff --git a/Sources/ModelsSTU3/CodeSystemSearchComparator.swift b/Sources/ModelsSTU3/CodeSystemSearchComparator.swift new file mode 100644 index 0000000..a121d48 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSearchComparator.swift @@ -0,0 +1,56 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + What Search Comparator Codes are supported in search + + URL: http://hl7.org/fhir/search-comparator + ValueSet: http://hl7.org/fhir/ValueSet/search-comparator + */ +public enum SearchComparator: String, FHIRPrimitiveType { + + /// the value for the parameter in the resource is equal to the provided value + case eq = "eq" + + /// the value for the parameter in the resource is not equal to the provided value + case ne = "ne" + + /// the value for the parameter in the resource is greater than the provided value + case gt = "gt" + + /// the value for the parameter in the resource is less than the provided value + case lt = "lt" + + /// the value for the parameter in the resource is greater or equal to the provided value + case ge = "ge" + + /// the value for the parameter in the resource is less or equal to the provided value + case le = "le" + + /// the value for the parameter in the resource starts after the provided value + case sa = "sa" + + /// the value for the parameter in the resource ends before the provided value + case eb = "eb" + + /// the value for the parameter in the resource is approximately the same to the provided value. + case ap = "ap" +} diff --git a/Sources/ModelsSTU3/CodeSystemSearchEntryMode.swift b/Sources/ModelsSTU3/CodeSystemSearchEntryMode.swift new file mode 100644 index 0000000..0182ee4 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSearchEntryMode.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Why an entry is in the result set - whether it's included as a match or because of an _include requirement. + + URL: http://hl7.org/fhir/search-entry-mode + ValueSet: http://hl7.org/fhir/ValueSet/search-entry-mode + */ +public enum SearchEntryMode: String, FHIRPrimitiveType { + + /// This resource matched the search specification. + case match = "match" + + /// This resource is returned because it is referred to from another resource in the search set. + case include = "include" + + /// An OperationOutcome that provides additional information about the processing of a search. + case outcome = "outcome" +} diff --git a/Sources/ModelsSTU3/CodeSystemSearchModifierCode.swift b/Sources/ModelsSTU3/CodeSystemSearchModifierCode.swift new file mode 100644 index 0000000..c98b555 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSearchModifierCode.swift @@ -0,0 +1,67 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A supported modifier for a search parameter. + + URL: http://hl7.org/fhir/search-modifier-code + ValueSet: http://hl7.org/fhir/ValueSet/search-modifier-code + */ +public enum SearchModifierCode: String, FHIRPrimitiveType { + + /// The search parameter returns resources that have a value or not. + case missing = "missing" + + /// The search parameter returns resources that have a value that exactly matches the supplied parameter (the whole + /// string, including casing and accents). + case exact = "exact" + + /// The search parameter returns resources that include the supplied parameter value anywhere within the field being + /// searched. + case contains = "contains" + + /// The search parameter returns resources that do not contain a match. + case not = "not" + + /// The search parameter is processed as a string that searches text associated with the code/value - either + /// CodeableConcept.text, Coding.display, or Identifier.type.text. + case text = "text" + + /// The search parameter is a URI (relative or absolute) that identifies a value set, and the search parameter tests + /// whether the coding is in the specified value set. + case `in` = "in" + + /// The search parameter is a URI (relative or absolute) that identifies a value set, and the search parameter tests + /// whether the coding is not in the specified value set. + case notIn = "not-in" + + /// The search parameter tests whether the value in a resource is subsumed by the specified value (is-a, or + /// hierarchical relationships). + case below = "below" + + /// The search parameter tests whether the value in a resource subsumes the specified value (is-a, or hierarchical + /// relationships). + case above = "above" + + /// The search parameter only applies to the Resource Type specified as a modifier (e.g. the modifier is not + /// actually :type, but :Patient etc.). + case type = "type" +} diff --git a/Sources/ModelsSTU3/CodeSystemSearchParamType.swift b/Sources/ModelsSTU3/CodeSystemSearchParamType.swift new file mode 100644 index 0000000..568c503 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSearchParamType.swift @@ -0,0 +1,57 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Data types allowed to be used for search parameters. + + URL: http://hl7.org/fhir/search-param-type + ValueSet: http://hl7.org/fhir/ValueSet/search-param-type + */ +public enum SearchParamType: String, FHIRPrimitiveType { + + /// Search parameter SHALL be a number (a whole number, or a decimal). + case number = "number" + + /// Search parameter is on a date/time. The date format is the standard XML format, though other formats may be + /// supported. + case date = "date" + + /// Search parameter is a simple string, like a name part. Search is case-insensitive and accent-insensitive. May + /// match just the start of a string. String parameters may contain spaces. + case string = "string" + + /// Search parameter on a coded element or identifier. May be used to search through the text, displayname, code and + /// code/codesystem (for codes) and label, system and key (for identifier). Its value is either a string or a pair + /// of namespace and value, separated by a "|", depending on the modifier used. + case token = "token" + + /// A reference to another resource. + case reference = "reference" + + /// A composite search parameter that combines a search on two values together. + case composite = "composite" + + /// A search parameter that searches on a quantity. + case quantity = "quantity" + + /// A search parameter that searches on a URI (RFC 3986). + case uri = "uri" +} diff --git a/Sources/ModelsSTU3/CodeSystemSequenceStatus.swift b/Sources/ModelsSTU3/CodeSystemSequenceStatus.swift new file mode 100644 index 0000000..8f83150 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSequenceStatus.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes providing the status of the variant test result + + URL: http://hl7.org/fhir/variant-state + ValueSet: http://hl7.org/fhir/ValueSet/variant-state + */ +public enum SequenceStatus: String, FHIRPrimitiveType { + + /// the variant is detected + case positive = "positive" + + /// no variant is detected + case negative = "negative" + + /// result of the variant is missing + case absent = "absent" +} diff --git a/Sources/ModelsSTU3/CodeSystemSequenceType.swift b/Sources/ModelsSTU3/CodeSystemSequenceType.swift new file mode 100644 index 0000000..c9f511f --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSequenceType.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Type if a sequence -- DNA, RNA, or amino acid sequence + + URL: http://hl7.org/fhir/sequence-type + ValueSet: http://hl7.org/fhir/ValueSet/sequence-type + */ +public enum SequenceType: String, FHIRPrimitiveType { + + /// Amino acid sequence + case aa = "aa" + + /// DNA Sequence + case dna = "dna" + + /// RNA Sequence + case rna = "rna" +} diff --git a/Sources/ModelsSTU3/CodeSystemServiceProvisionConditions.swift b/Sources/ModelsSTU3/CodeSystemServiceProvisionConditions.swift new file mode 100644 index 0000000..f16bd5e --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemServiceProvisionConditions.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The code(s) that detail the conditions under which the healthcare service is available/offered. + + URL: http://hl7.org/fhir/service-provision-conditions + ValueSet: http://hl7.org/fhir/ValueSet/service-provision-conditions + */ +public enum ServiceProvisionConditions: String, FHIRPrimitiveType { + + /// This service is available for no patient cost. + case free = "free" + + /// There are discounts available on this service for qualifying patients. + case disc = "disc" + + /// Fees apply for this service. + case cost = "cost" +} diff --git a/Sources/ModelsSTU3/CodeSystemSlicingRules.swift b/Sources/ModelsSTU3/CodeSystemSlicingRules.swift new file mode 100644 index 0000000..4920524 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSlicingRules.swift @@ -0,0 +1,39 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How slices are interpreted when evaluating an instance. + + URL: http://hl7.org/fhir/resource-slicing-rules + ValueSet: http://hl7.org/fhir/ValueSet/resource-slicing-rules + */ +public enum SlicingRules: String, FHIRPrimitiveType { + + /// No additional content is allowed other than that described by the slices in this profile. + case closed = "closed" + + /// Additional content is allowed anywhere in the list. + case open = "open" + + /// Additional content is allowed, but only at the end of the list. Note that using this requires that the slices be + /// ordered, which makes it hard to share uses. This should only be done where absolutely required. + case openAtEnd = "openAtEnd" +} diff --git a/Sources/ModelsSTU3/CodeSystemSlotStatus.swift b/Sources/ModelsSTU3/CodeSystemSlotStatus.swift new file mode 100644 index 0000000..21f9c99 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSlotStatus.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The free/busy status of the slot. + + URL: http://hl7.org/fhir/slotstatus + ValueSet: http://hl7.org/fhir/ValueSet/slotstatus + */ +public enum SlotStatus: String, FHIRPrimitiveType { + + /// Indicates that the time interval is busy because one or more events have been scheduled for that interval. + case busy = "busy" + + /// Indicates that the time interval is free for scheduling. + case free = "free" + + /// Indicates that the time interval is busy and that the interval can not be scheduled. + case busyUnavailable = "busy-unavailable" + + /// Indicates that the time interval is busy because one or more events have been tentatively scheduled for that + /// interval. + case busyTentative = "busy-tentative" + + /// This instance should not have been part of this patient's medical record. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemSpecialValues.swift b/Sources/ModelsSTU3/CodeSystemSpecialValues.swift new file mode 100644 index 0000000..a63f6c6 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSpecialValues.swift @@ -0,0 +1,48 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A set of generally useful codes defined so they can be included in value sets. + + URL: http://hl7.org/fhir/special-values + ValueSet: http://hl7.org/fhir/ValueSet/special-values + */ +public enum SpecialValues: String, FHIRPrimitiveType { + + /// Boolean true. + case `true` = "true" + + /// Boolean false. + case `false` = "false" + + /// The content is greater than zero, but too small to be quantified. + case trace = "trace" + + /// The specific quantity is not known, but is known to be non-zero and is not specified because it makes up the + /// bulk of the material. + case sufficient = "sufficient" + + /// The value is no longer available. + case withdrawn = "withdrawn" + + /// The are no known applicable values in this context. + case nilKnown = "nil-known" +} diff --git a/Sources/ModelsSTU3/CodeSystemSpecimenStatus.swift b/Sources/ModelsSTU3/CodeSystemSpecimenStatus.swift new file mode 100644 index 0000000..9085e9b --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSpecimenStatus.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes providing the status/availability of a specimen. + + URL: http://hl7.org/fhir/specimen-status + ValueSet: http://hl7.org/fhir/ValueSet/specimen-status + */ +public enum SpecimenStatus: String, FHIRPrimitiveType { + + /// The physical specimen is present and in good condition. + case available = "available" + + /// There is no physical specimen because it is either lost, destroyed or consumed. + case unavailable = "unavailable" + + /// The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old. + case unsatisfactory = "unsatisfactory" + + /// The specimen was entered in error and therefore nullified. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemStrengthOfRecommendationRating.swift b/Sources/ModelsSTU3/CodeSystemStrengthOfRecommendationRating.swift new file mode 100644 index 0000000..60ae4bd --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemStrengthOfRecommendationRating.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A rating system that describes the strength of the recommendation, such as the GRADE, DynaMed, or HGPS systems + + URL: http://hl7.org/fhir/recommendation-strength + ValueSet: http://hl7.org/fhir/ValueSet/cqif-recommendation-strength + */ +public enum StrengthOfRecommendationRating: String, FHIRPrimitiveType { + + /// Strong recommendation + case strong = "strong" + + /// Weak recommendation + case weak = "weak" +} diff --git a/Sources/ModelsSTU3/CodeSystemStructureDefinitionKind.swift b/Sources/ModelsSTU3/CodeSystemStructureDefinitionKind.swift new file mode 100644 index 0000000..e1a410e --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemStructureDefinitionKind.swift @@ -0,0 +1,43 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines the type of structure that a definition is describing. + + URL: http://hl7.org/fhir/structure-definition-kind + ValueSet: http://hl7.org/fhir/ValueSet/structure-definition-kind + */ +public enum StructureDefinitionKind: String, FHIRPrimitiveType { + + /// A primitive type that has a value and an extension. These can be used throughout Resource and extension + /// definitions. Only the base specification can define primitive types. + case primitiveType = "primitive-type" + + /// A complex structure that defines a set of data elements. These can be used throughout Resource and extension + /// definitions, and in logical models. + case complexType = "complex-type" + + /// A resource defined by the FHIR specification. + case resource = "resource" + + /// A conceptual package of data that will be mapped to resources for implementation. + case logical = "logical" +} diff --git a/Sources/ModelsSTU3/CodeSystemStructureMapContextType.swift b/Sources/ModelsSTU3/CodeSystemStructureMapContextType.swift new file mode 100644 index 0000000..023f1de --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemStructureMapContextType.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How to interpret the context + + URL: http://hl7.org/fhir/map-context-type + ValueSet: http://hl7.org/fhir/ValueSet/map-context-type + */ +public enum StructureMapContextType: String, FHIRPrimitiveType { + + /// The context specifies a type + case type = "type" + + /// The context specifies a variable + case variable = "variable" +} diff --git a/Sources/ModelsSTU3/CodeSystemStructureMapGroupTypeMode.swift b/Sources/ModelsSTU3/CodeSystemStructureMapGroupTypeMode.swift new file mode 100644 index 0000000..ae20dd3 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemStructureMapGroupTypeMode.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + If this is the default rule set to apply for the source type, or this combination of types + + URL: http://hl7.org/fhir/map-group-type-mode + ValueSet: http://hl7.org/fhir/ValueSet/map-group-type-mode + */ +public enum StructureMapGroupTypeMode: String, FHIRPrimitiveType { + + /// This group is not a default group for the types + case none = "none" + + /// This group is a default mapping group for the specified types and for the primary source type + case types = "types" + + /// This group is a default mapping group for the specified types + case typeAndTypes = "type-and-types" +} diff --git a/Sources/ModelsSTU3/CodeSystemStructureMapInputMode.swift b/Sources/ModelsSTU3/CodeSystemStructureMapInputMode.swift new file mode 100644 index 0000000..faafc1e --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemStructureMapInputMode.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Mode for this instance of data + + URL: http://hl7.org/fhir/map-input-mode + ValueSet: http://hl7.org/fhir/ValueSet/map-input-mode + */ +public enum StructureMapInputMode: String, FHIRPrimitiveType { + + /// Names an input instance used a source for mapping + case source = "source" + + /// Names an instance that is being populated + case target = "target" +} diff --git a/Sources/ModelsSTU3/CodeSystemStructureMapModelMode.swift b/Sources/ModelsSTU3/CodeSystemStructureMapModelMode.swift new file mode 100644 index 0000000..821edf5 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemStructureMapModelMode.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How the referenced structure is used in this mapping + + URL: http://hl7.org/fhir/map-model-mode + ValueSet: http://hl7.org/fhir/ValueSet/map-model-mode + */ +public enum StructureMapModelMode: String, FHIRPrimitiveType { + + /// This structure describes an instance passed to the mapping engine that is used a source of data + case source = "source" + + /// This structure describes an instance that the mapping engine may ask for that is used a source of data + case queried = "queried" + + /// This structure describes an instance passed to the mapping engine that is used a target of data + case target = "target" + + /// This structure describes an instance that the mapping engine may ask to create that is used a target of data + case produced = "produced" +} diff --git a/Sources/ModelsSTU3/CodeSystemStructureMapSourceListMode.swift b/Sources/ModelsSTU3/CodeSystemStructureMapSourceListMode.swift new file mode 100644 index 0000000..9d81696 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemStructureMapSourceListMode.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + If field is a list, how to manage the source + + URL: http://hl7.org/fhir/map-source-list-mode + ValueSet: http://hl7.org/fhir/ValueSet/map-source-list-mode + */ +public enum StructureMapSourceListMode: String, FHIRPrimitiveType { + + /// Only process this rule for the first in the list + case first = "first" + + /// Process this rule for all but the first + case not_first = "not_first" + + /// Only process this rule for the last in the list + case last = "last" + + /// Process this rule for all but the last + case not_last = "not_last" + + /// Only process this rule is there is only item + case only_one = "only_one" +} diff --git a/Sources/ModelsSTU3/CodeSystemStructureMapTargetListMode.swift b/Sources/ModelsSTU3/CodeSystemStructureMapTargetListMode.swift new file mode 100644 index 0000000..65359f8 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemStructureMapTargetListMode.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + If field is a list, how to manage the production + + URL: http://hl7.org/fhir/map-target-list-mode + ValueSet: http://hl7.org/fhir/ValueSet/map-target-list-mode + */ +public enum StructureMapTargetListMode: String, FHIRPrimitiveType { + + /// when the target list is being assembled, the items for this rule go first. If more that one rule defines a first + /// item (for a given instance of mapping) then this is an error + case first = "first" + + /// the target instance is shared with the target instances generated by another rule (up to the first common n + /// items, then create new ones) + case share = "share" + + /// when the target list is being assembled, the items for this rule go last. If more that one rule defines a last + /// item (for a given instance of mapping) then this is an error + case last = "last" + + /// re-use the first item in the list, and keep adding content to it + case collate = "collate" +} diff --git a/Sources/ModelsSTU3/CodeSystemStructureMapTransform.swift b/Sources/ModelsSTU3/CodeSystemStructureMapTransform.swift new file mode 100644 index 0000000..d34525d --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemStructureMapTransform.swift @@ -0,0 +1,85 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How data is copied/created + + URL: http://hl7.org/fhir/map-transform + ValueSet: http://hl7.org/fhir/ValueSet/map-transform + */ +public enum StructureMapTransform: String, FHIRPrimitiveType { + + /// create(type : string) - type is passed through to the application on the standard API, and must be known by it + case create = "create" + + /// copy(source) + case copy = "copy" + + /// truncate(source, length) - source must be stringy type + case truncate = "truncate" + + /// escape(source, fmt1, fmt2) - change source from one kind of escaping to another (plain, java, xml, json). note + /// that this is for when the string itself is escaped + case escape = "escape" + + /// cast(source, type?) - case source from one type to another. target type can be left as implicit if there is one + /// and only one target type known + case cast = "cast" + + /// append(source...) - source is element or string + case append = "append" + + /// translate(source, uri_of_map) - use the translate operation + case translate = "translate" + + /// reference(source : object) - return a string that references the provided tree properly + case reference = "reference" + + /// Perform a date operation. *Parameters to be documented* + case dateOp = "dateOp" + + /// Generate a random UUID (in lowercase). No Parameters + case uuid = "uuid" + + /// Return the appropriate string to put in a reference that refers to the resource provided as a parameter + case pointer = "pointer" + + /// Execute the supplied fluentpath expression and use the value returned by that + case evaluate = "evaluate" + + /// Create a CodeableConcept. Parameters = (text) or (system. Code[, display]) + case cc = "cc" + + /// Create a Coding. Parameters = (system. Code[, display]) + case C = "c" + + /// Create a quantity. Parameters = (text) or (value, unit, [system, code]) where text is the natural representation + /// e.g. [comparator]value[space]unit + case qty = "qty" + + /// Create an identifier. Parameters = (system, value[, type]) where type is a code from the identifier type value + /// set + case id = "id" + + /// Create a contact details. Parameters = (value) or (system, value). If no system is provided, the system should + /// be inferred from the content of the value + case cp = "cp" +} diff --git a/Sources/ModelsSTU3/CodeSystemSubscriptionChannelType.swift b/Sources/ModelsSTU3/CodeSystemSubscriptionChannelType.swift new file mode 100644 index 0000000..5cbd4dd --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSubscriptionChannelType.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of method used to execute a subscription. + + URL: http://hl7.org/fhir/subscription-channel-type + ValueSet: http://hl7.org/fhir/ValueSet/subscription-channel-type + */ +public enum SubscriptionChannelType: String, FHIRPrimitiveType { + + /// The channel is executed by making a post to the URI. If a payload is included, the URL is interpreted as the + /// service base, and an update (PUT) is made. + case restHook = "rest-hook" + + /// The channel is executed by sending a packet across a web socket connection maintained by the client. The URL + /// identifies the websocket, and the client binds to this URL. + case websocket = "websocket" + + /// The channel is executed by sending an email to the email addressed in the URI (which must be a mailto:). + case email = "email" + + /// The channel is executed by sending an SMS message to the phone number identified in the URL (tel:). + case sms = "sms" + + /// The channel is executed by sending a message (e.g. a Bundle with a MessageHeader resource etc.) to the + /// application identified in the URI. + case message = "message" +} diff --git a/Sources/ModelsSTU3/CodeSystemSubscriptionStatus.swift b/Sources/ModelsSTU3/CodeSystemSubscriptionStatus.swift new file mode 100644 index 0000000..e0a4608 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSubscriptionStatus.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The status of a subscription. + + URL: http://hl7.org/fhir/subscription-status + ValueSet: http://hl7.org/fhir/ValueSet/subscription-status + */ +public enum SubscriptionStatus: String, FHIRPrimitiveType { + + /// The client has requested the subscription, and the server has not yet set it up. + case requested = "requested" + + /// The subscription is active. + case active = "active" + + /// The server has an error executing the notification. + case error = "error" + + /// Too many errors have occurred or the subscription has expired. + case off = "off" +} diff --git a/Sources/ModelsSTU3/CodeSystemSubscriptionTag.swift b/Sources/ModelsSTU3/CodeSystemSubscriptionTag.swift new file mode 100644 index 0000000..9525790 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSubscriptionTag.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Tags to put on a resource after subscriptions have been sent. + + URL: http://hl7.org/fhir/subscription-tag + ValueSet: http://hl7.org/fhir/ValueSet/subscription-tag + */ +public enum SubscriptionTag: String, FHIRPrimitiveType { + + /// The message has been queued for processing on a destination systems. + case queued = "queued" + + /// The message has been delivered to its intended recipient. + case delivered = "delivered" +} diff --git a/Sources/ModelsSTU3/CodeSystemSupplyDeliveryStatus.swift b/Sources/ModelsSTU3/CodeSystemSupplyDeliveryStatus.swift new file mode 100644 index 0000000..bebdc49 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSupplyDeliveryStatus.swift @@ -0,0 +1,42 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Status of the supply delivery. + + URL: http://hl7.org/fhir/supplydelivery-status + ValueSet: http://hl7.org/fhir/ValueSet/supplydelivery-status + */ +public enum SupplyDeliveryStatus: String, FHIRPrimitiveType { + + /// Supply has been requested, but not delivered. + case inProgress = "in-progress" + + /// Supply has been delivered ("completed"). + case completed = "completed" + + /// Delivery was not completed. + case abandoned = "abandoned" + + /// This electronic record should never have existed, though it is possible that real-world decisions were based on + /// it. (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".) + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemSupplyRequestReason.swift b/Sources/ModelsSTU3/CodeSystemSupplyRequestReason.swift new file mode 100644 index 0000000..af7c7e0 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSupplyRequestReason.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Why the supply item was requested + + URL: http://hl7.org/fhir/supplyrequest-reason + ValueSet: http://hl7.org/fhir/ValueSet/supplyrequest-reason + */ +public enum SupplyRequestReason: String, FHIRPrimitiveType { + + /// The supply has been requested for use in direct patient care. + case patientCare = "patient-care" + + /// The supply has been requested for for creating or replenishing ward stock. + case wardStock = "ward-stock" +} diff --git a/Sources/ModelsSTU3/CodeSystemSupplyRequestStatus.swift b/Sources/ModelsSTU3/CodeSystemSupplyRequestStatus.swift new file mode 100644 index 0000000..ab51b3c --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSupplyRequestStatus.swift @@ -0,0 +1,54 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Status of the supply request + + URL: http://hl7.org/fhir/supplyrequest-status + ValueSet: http://hl7.org/fhir/ValueSet/supplyrequest-status + */ +public enum SupplyRequestStatus: String, FHIRPrimitiveType { + + /// The request has been created but is not yet complete or ready for action + case draft = "draft" + + /// The request is ready to be acted upon + case active = "active" + + /// The authorization/request to act has been temporarily withdrawn but is expected to resume in the future + case suspended = "suspended" + + /// The authorization/request to act has been terminated prior to the full completion of the intended actions. No + /// further activity should occur. + case cancelled = "cancelled" + + /// Activity against the request has been sufficiently completed to the satisfaction of the requester + case completed = "completed" + + /// This electronic record should never have existed, though it is possible that real-world decisions were based on + /// it. (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".) + case enteredInError = "entered-in-error" + + /// The authoring system does not know which of the status values currently applies for this request. Note: This + /// concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known + /// which one. + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemSystemVersionProcessingMode.swift b/Sources/ModelsSTU3/CodeSystemSystemVersionProcessingMode.swift new file mode 100644 index 0000000..7c36dae --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemSystemVersionProcessingMode.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How to manage the intersection between a fixed version in a value set, and a fixed version of the system in the + expansion profile + + URL: http://hl7.org/fhir/system-version-processing-mode + ValueSet: http://hl7.org/fhir/ValueSet/system-version-processing-mode + */ +public enum SystemVersionProcessingMode: String, FHIRPrimitiveType { + + /// Use this version of the code system if a value set doesn't specify a version + case `default` = "default" + + /// Use this version of the code system. If a value set specifies a different version, the expansion operation + /// should fail + case check = "check" + + /// Use this version of the code system irrespective of which version is specified by a value set. Note that this + /// has obvious safety issues, in that it may result in a value set expansion giving a different list of codes that + /// is both wrong and unsafe, and implementers should only use this capability reluctantly. It primarily exists to + /// deal with situations where specifications have fallen into decay as time passes. If a version is override, the + /// version used SHALL explicitly be represented in the expansion parameters + case override = "override" +} diff --git a/Sources/ModelsSTU3/CodeSystemTaskPerformerType.swift b/Sources/ModelsSTU3/CodeSystemTaskPerformerType.swift new file mode 100644 index 0000000..e267cc4 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemTaskPerformerType.swift @@ -0,0 +1,53 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type(s) of task performers allowed + + URL: http://hl7.org/fhir/task-performer-type + ValueSet: http://hl7.org/fhir/ValueSet/task-performer-type + */ +public enum TaskPerformerType: String, FHIRPrimitiveType { + + /// A workflow participant that requests services. + case requester = "requester" + + /// A workflow participant that dispatches services (assigns another task to a participant). + case dispatcher = "dispatcher" + + /// A workflow participant that schedules (dispatches and sets the time or date for performance of) services. + case scheduler = "scheduler" + + /// A workflow participant that performs services. + case performer = "performer" + + /// A workflow participant that monitors task activity. + case monitor = "monitor" + + /// A workflow participant that manages task activity. + case manager = "manager" + + /// A workflow participant that acquires resources (specimens, images, etc) necessary to perform the task. + case acquirer = "acquirer" + + /// A workflow participant that reviews task inputs or outputs. + case reviewer = "reviewer" +} diff --git a/Sources/ModelsSTU3/CodeSystemTaskStatus.swift b/Sources/ModelsSTU3/CodeSystemTaskStatus.swift new file mode 100644 index 0000000..ec64951 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemTaskStatus.swift @@ -0,0 +1,67 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The current status of the task. + + URL: http://hl7.org/fhir/task-status + ValueSet: http://hl7.org/fhir/ValueSet/task-status + */ +public enum TaskStatus: String, FHIRPrimitiveType { + + /// The task is not yet ready to be acted upon. + case draft = "draft" + + /// The task is ready to be acted upon and action is sought. + case requested = "requested" + + /// A potential performer has claimed ownership of the task and is evaluating whether to perform it. + case received = "received" + + /// The potential performer has agreed to execute the task but has not yet started work. + case accepted = "accepted" + + /// The potential performer who claimed ownership of the task has decided not to execute it prior to performing any + /// action. + case rejected = "rejected" + + /// Task is ready to be performed, but no action has yet been taken. Used in place of + /// requested/received/accepted/rejected when request assignment and acceptance is a given. + case ready = "ready" + + /// The task was not completed. + case cancelled = "cancelled" + + /// Task has been started but is not yet complete. + case inProgress = "in-progress" + + /// Task has been started but work has been paused. + case onHold = "on-hold" + + /// The task was attempted but could not be completed due to some error. + case failed = "failed" + + /// The task has been completed. + case completed = "completed" + + /// The task should never have existed and is retained only because of the possibility it may have used. + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemTestReportActionResult.swift b/Sources/ModelsSTU3/CodeSystemTestReportActionResult.swift new file mode 100644 index 0000000..c6d8231 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemTestReportActionResult.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The results of executing an action. + + URL: http://hl7.org/fhir/report-action-result-codes + ValueSet: http://hl7.org/fhir/ValueSet/report-action-result-codes + */ +public enum TestReportActionResult: String, FHIRPrimitiveType { + + /// The action was successful. + case pass = "pass" + + /// The action was skipped. + case skip = "skip" + + /// The action failed. + case fail = "fail" + + /// The action passed but with warnings. + case warning = "warning" + + /// The action encountered a fatal error and the engine was unable to process. + case error = "error" +} diff --git a/Sources/ModelsSTU3/CodeSystemTestReportParticipantType.swift b/Sources/ModelsSTU3/CodeSystemTestReportParticipantType.swift new file mode 100644 index 0000000..3347a57 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemTestReportParticipantType.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of participant. + + URL: http://hl7.org/fhir/report-participant-type + ValueSet: http://hl7.org/fhir/ValueSet/report-participant-type + */ +public enum TestReportParticipantType: String, FHIRPrimitiveType { + + /// The test execution engine. + case testEngine = "test-engine" + + /// A FHIR Client + case client = "client" + + /// A FHIR Server + case server = "server" +} diff --git a/Sources/ModelsSTU3/CodeSystemTestReportResult.swift b/Sources/ModelsSTU3/CodeSystemTestReportResult.swift new file mode 100644 index 0000000..0417854 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemTestReportResult.swift @@ -0,0 +1,38 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The reported execution result. + + URL: http://hl7.org/fhir/report-result-codes + ValueSet: http://hl7.org/fhir/ValueSet/report-result-codes + */ +public enum TestReportResult: String, FHIRPrimitiveType { + + /// All test operations successfully passed all asserts + case pass = "pass" + + /// One or more test operations failed one or more asserts + case fail = "fail" + + /// One or more test operations is pending execution completion + case pending = "pending" +} diff --git a/Sources/ModelsSTU3/CodeSystemTestReportStatus.swift b/Sources/ModelsSTU3/CodeSystemTestReportStatus.swift new file mode 100644 index 0000000..5ba5f5e --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemTestReportStatus.swift @@ -0,0 +1,44 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The current status of the test report. + + URL: http://hl7.org/fhir/report-status-codes + ValueSet: http://hl7.org/fhir/ValueSet/report-status-codes + */ +public enum TestReportStatus: String, FHIRPrimitiveType { + + /// All test operations have completed + case completed = "completed" + + /// A test operations is currently executing + case inProgress = "in-progress" + + /// A test operation is waiting for an external client request + case waiting = "waiting" + + /// The test script execution was manually stopped + case stopped = "stopped" + + /// This test report was entered or created in error + case enteredInError = "entered-in-error" +} diff --git a/Sources/ModelsSTU3/CodeSystemTestScriptRequestMethodCode.swift b/Sources/ModelsSTU3/CodeSystemTestScriptRequestMethodCode.swift new file mode 100644 index 0000000..a8a5c7d --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemTestScriptRequestMethodCode.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The allowable request method or HTTP operation codes. + + URL: http://hl7.org/fhir/http-operations + ValueSet: http://hl7.org/fhir/ValueSet/http-operations + */ +public enum TestScriptRequestMethodCode: String, FHIRPrimitiveType { + + /// HTTP DELETE operation + case delete = "delete" + + /// HTTP GET operation + case get = "get" + + /// HTTP OPTIONS operation + case options = "options" + + /// HTTP PATCH operation + case patch = "patch" + + /// HTTP POST operation + case post = "post" + + /// HTTP PUT operation + case put = "put" +} diff --git a/Sources/ModelsSTU3/CodeSystemTransactionMode.swift b/Sources/ModelsSTU3/CodeSystemTransactionMode.swift new file mode 100644 index 0000000..33c0f11 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemTransactionMode.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code that indicates how transactions are supported. + + URL: http://hl7.org/fhir/transaction-mode + ValueSet: http://hl7.org/fhir/ValueSet/transaction-mode + */ +public enum TransactionMode: String, FHIRPrimitiveType { + + /// Neither batch or transaction is supported. + case notSupported = "not-supported" + + /// Batches are supported. + case batch = "batch" + + /// Transactions are supported. + case transaction = "transaction" + + /// Both batches and transactions are supported. + case both = "both" +} diff --git a/Sources/ModelsSTU3/CodeSystemTriggerType.swift b/Sources/ModelsSTU3/CodeSystemTriggerType.swift new file mode 100644 index 0000000..d81a1c4 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemTriggerType.swift @@ -0,0 +1,50 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The type of trigger + + URL: http://hl7.org/fhir/trigger-type + ValueSet: http://hl7.org/fhir/ValueSet/trigger-type + */ +public enum TriggerType: String, FHIRPrimitiveType { + + /// The trigger occurs in response to a specific named event + case namedEvent = "named-event" + + /// The trigger occurs at a specific time or periodically as described by a timing or schedule + case periodic = "periodic" + + /// The trigger occurs whenever data of a particular type is added + case dataAdded = "data-added" + + /// The trigger occurs whenever data of a particular type is modified + case dataModified = "data-modified" + + /// The trigger occurs whenever data of a particular type is removed + case dataRemoved = "data-removed" + + /// The trigger occurs whenever data of a particular type is accessed + case dataAccessed = "data-accessed" + + /// The trigger occurs whenever access to data of a particular type is completed + case dataAccessEnded = "data-access-ended" +} diff --git a/Sources/ModelsSTU3/CodeSystemTypeDerivationRule.swift b/Sources/ModelsSTU3/CodeSystemTypeDerivationRule.swift new file mode 100644 index 0000000..ca2a970 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemTypeDerivationRule.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How a type relates to its baseDefinition. + + URL: http://hl7.org/fhir/type-derivation-rule + ValueSet: http://hl7.org/fhir/ValueSet/type-derivation-rule + */ +public enum TypeDerivationRule: String, FHIRPrimitiveType { + + /// This definition defines a new type that adds additional elements to the base type + case specialization = "specialization" + + /// This definition adds additional rules to an existing concrete type + case constraint = "constraint" +} diff --git a/Sources/ModelsSTU3/CodeSystemUDIEntryType.swift b/Sources/ModelsSTU3/CodeSystemUDIEntryType.swift new file mode 100644 index 0000000..c139b04 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemUDIEntryType.swift @@ -0,0 +1,47 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Codes to identify how UDI data was entered + + URL: http://hl7.org/fhir/udi-entry-type + ValueSet: http://hl7.org/fhir/ValueSet/udi-entry-type + */ +public enum UDIEntryType: String, FHIRPrimitiveType { + + /// A Barcode scanner captured the data from the device label + case barcode = "barcode" + + /// An RFID chip reader captured the data from the device label + case rfid = "rfid" + + /// The data was read from the label by a person and manually entered. (e.g. via a keyboard) + case manual = "manual" + + /// The data originated from a patient's implant card and read by an operator. + case card = "card" + + /// The data originated from a patient source and not directly scanned or read from a label or card. + case selfReported = "self-reported" + + /// The method of data capture has not been determined + case unknown = "unknown" +} diff --git a/Sources/ModelsSTU3/CodeSystemUnknownContentCode.swift b/Sources/ModelsSTU3/CodeSystemUnknownContentCode.swift new file mode 100644 index 0000000..af8eaf9 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemUnknownContentCode.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code that indicates whether an application accepts unknown elements or extensions when reading resources. + + URL: http://hl7.org/fhir/unknown-content-code + ValueSet: http://hl7.org/fhir/ValueSet/unknown-content-code + */ +public enum UnknownContentCode: String, FHIRPrimitiveType { + + /// The application does not accept either unknown elements or extensions. + case no = "no" + + /// The application accepts unknown extensions, but not unknown elements. + case extensions = "extensions" + + /// The application accepts unknown elements, but not unknown extensions. + case elements = "elements" + + /// The application accepts unknown elements and extensions. + case both = "both" +} diff --git a/Sources/ModelsSTU3/CodeSystemUsageContextType.swift b/Sources/ModelsSTU3/CodeSystemUsageContextType.swift new file mode 100644 index 0000000..b30218f --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemUsageContextType.swift @@ -0,0 +1,63 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A code that specifies a type of context being specified by a usage context + + URL: http://hl7.org/fhir/usage-context-type + ValueSet: http://hl7.org/fhir/ValueSet/usage-context-type + */ +public enum UsageContextType: String, FHIRPrimitiveType { + + /// The gender of the patient. For this context type, the value should be a code taken from the + /// http://hl7.org/fhir/ValueSet/administrative-gender value set + case gender = "gender" + + /// The age of the patient. For this context type, the value should be a range the specifies the applicable ages or + /// a code from the MeSH value set http://hl7.org/fhir/ValueSet/v3-AgeGroupObservationValue + case age = "age" + + /// The clinical concept(s) addressed by the artifact. For example, disease, diagnostic test interpretation, + /// medication ordering as in http://hl7.org/fhir/ValueSet/condition-code. + case focus = "focus" + + /// The clinical specialty of the context in which the patient is being treated - For example, PCP, Patient, + /// Cardiologist, Behavioral Professional, Oral Health Professional, Prescriber, etc... taken from the NUCC Health + /// Care provider taxonomy value set http://hl7.org/fhir/ValueSet/provider-taxonomy. + case user = "user" + + /// The settings in which the artifact is intended for use. For example, admission, pre-op, etc. For example, the + /// ActEncounterCode value set http://hl7.org/fhir/ValueSet/v3-ActEncounterCode + case workflow = "workflow" + + /// The context for the clinical task(s) represented by this artifact. Can be any task context represented by the + /// HL7 ActTaskCode value set http://hl7.org/fhir/ValueSet/v3-ActTaskCode. General categories include: order entry, + /// patient documentation and patient information review. + case task = "task" + + /// The venue in which an artifact could be used. For example, Outpatient, Inpatient, Home, Nursing home. The code + /// value may originate from either the HL7 ActEncounterCode http://hl7.org/fhir/ValueSet/v3-ActEncounterCode or + /// NUCC non-individual provider codes http://hl7.org/fhir/ValueSet/provider-taxonomy + case venue = "venue" + + /// The species to which an artifact applies. For example, SNOMED - 387961004 | Kingdom Animalia (organism). + case species = "species" +} diff --git a/Sources/ModelsSTU3/CodeSystemUse.swift b/Sources/ModelsSTU3/CodeSystemUse.swift new file mode 100644 index 0000000..ffef4d5 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemUse.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Complete, proposed, exploratory, other + + URL: http://hl7.org/fhir/claim-use + ValueSet: http://hl7.org/fhir/ValueSet/claim-use + */ +public enum Use: String, FHIRPrimitiveType { + + /// The treatment is complete and this represents a Claim for the services. + case complete = "complete" + + /// The treatment is proposed and this represents a Pre-authorization for the services. + case proposed = "proposed" + + /// The treatment is proposed and this represents a Pre-determination for the services. + case exploratory = "exploratory" + + /// A locally defined or otherwise resolved status. + case other = "other" +} diff --git a/Sources/ModelsSTU3/CodeSystemVisionBase.swift b/Sources/ModelsSTU3/CodeSystemVisionBase.swift new file mode 100644 index 0000000..25b04a6 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemVisionBase.swift @@ -0,0 +1,41 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept listing the base codes. + + URL: http://hl7.org/fhir/vision-base-codes + ValueSet: http://hl7.org/fhir/ValueSet/vision-base-codes + */ +public enum VisionBase: String, FHIRPrimitiveType { + + /// top + case up = "up" + + /// bottom + case down = "down" + + /// inner edge + case `in` = "in" + + /// outer edge + case out = "out" +} diff --git a/Sources/ModelsSTU3/CodeSystemVisionEyes.swift b/Sources/ModelsSTU3/CodeSystemVisionEyes.swift new file mode 100644 index 0000000..e0c3657 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemVisionEyes.swift @@ -0,0 +1,35 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A coded concept listing the eye codes. + + URL: http://hl7.org/fhir/vision-eye-codes + ValueSet: http://hl7.org/fhir/ValueSet/vision-eye-codes + */ +public enum VisionEyes: String, FHIRPrimitiveType { + + /// Right Eye + case right = "right" + + /// Left Eye + case left = "left" +} diff --git a/Sources/ModelsSTU3/CodeSystemXPathUsageType.swift b/Sources/ModelsSTU3/CodeSystemXPathUsageType.swift new file mode 100644 index 0000000..47fdf04 --- /dev/null +++ b/Sources/ModelsSTU3/CodeSystemXPathUsageType.swift @@ -0,0 +1,45 @@ +// +// CodeSystems.swift +// HealthRecords +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How a search parameter relates to the set of elements returned by evaluating its xpath query. + + URL: http://hl7.org/fhir/search-xpath-usage + ValueSet: http://hl7.org/fhir/ValueSet/search-xpath-usage + */ +public enum XPathUsageType: String, FHIRPrimitiveType { + + /// The search parameter is derived directly from the selected nodes based on the type definitions. + case normal = "normal" + + /// The search parameter is derived by a phonetic transform from the selected nodes. + case phonetic = "phonetic" + + /// The search parameter is based on a spatial transform of the selected nodes. + case nearby = "nearby" + + /// The search parameter is based on a spatial transform of the selected nodes, using physical distance from the + /// middle. + case distance = "distance" + + /// The interpretation of the xpath statement is unknown (and can't be automated). + case other = "other" +} diff --git a/Sources/ModelsSTU3/CodeableConcept.swift b/Sources/ModelsSTU3/CodeableConcept.swift new file mode 100644 index 0000000..781a434 --- /dev/null +++ b/Sources/ModelsSTU3/CodeableConcept.swift @@ -0,0 +1,99 @@ +// +// CodeableConcept.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CodeableConcept) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Concept - reference to a terminology or just text. + + A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text. + */ +open class CodeableConcept: Element { + + /// Code defined by a terminology system + public var coding: [Coding]? + + /// Plain text representation of the concept + public var text: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + coding: [Coding]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + text: FHIRPrimitive? = nil) + { + self.init() + self.coding = coding + self.`extension` = `extension` + self.id = id + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case coding + case text; case _text + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.coding = try [Coding](from: _container, forKeyIfPresent: .coding) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try coding?.encode(on: &_container, forKey: .coding) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CodeableConcept else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return coding == _other.coding + && text == _other.text + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(coding) + hasher.combine(text) + } +} diff --git a/Sources/ModelsSTU3/Coding.swift b/Sources/ModelsSTU3/Coding.swift new file mode 100644 index 0000000..c36933b --- /dev/null +++ b/Sources/ModelsSTU3/Coding.swift @@ -0,0 +1,127 @@ +// +// Coding.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Coding) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A reference to a code defined by a terminology system. + */ +open class Coding: Element { + + /// Identity of the terminology system + public var system: FHIRPrimitive? + + /// Version of the system - if relevant + public var version: FHIRPrimitive? + + /// Symbol in syntax defined by the system + public var code: FHIRPrimitive? + + /// Representation defined by the system + public var display: FHIRPrimitive? + + /// If this coding was chosen directly by the user + public var userSelected: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive? = nil, + display: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + system: FHIRPrimitive? = nil, + userSelected: FHIRPrimitive? = nil, + version: FHIRPrimitive? = nil) + { + self.init() + self.code = code + self.display = display + self.`extension` = `extension` + self.id = id + self.system = system + self.userSelected = userSelected + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case display; case _display + case system; case _system + case userSelected; case _userSelected + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKeyIfPresent: .code, auxiliaryKey: ._code) + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + self.system = try FHIRPrimitive(from: _container, forKeyIfPresent: .system, auxiliaryKey: ._system) + self.userSelected = try FHIRPrimitive(from: _container, forKeyIfPresent: .userSelected, auxiliaryKey: ._userSelected) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try system?.encode(on: &_container, forKey: .system, auxiliaryKey: ._system) + try userSelected?.encode(on: &_container, forKey: .userSelected, auxiliaryKey: ._userSelected) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Coding else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && display == _other.display + && system == _other.system + && userSelected == _other.userSelected + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(display) + hasher.combine(system) + hasher.combine(userSelected) + hasher.combine(version) + } +} diff --git a/Sources/ModelsSTU3/Communication.swift b/Sources/ModelsSTU3/Communication.swift new file mode 100644 index 0000000..b8a0d07 --- /dev/null +++ b/Sources/ModelsSTU3/Communication.swift @@ -0,0 +1,408 @@ +// +// Communication.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Communication) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A record of information transmitted from a sender to a receiver. + + An occurrence of information being transmitted; e.g. an alert that was sent to a responsible provider, a public health + agency was notified about a reportable condition. + */ +open class Communication: DomainResource { + + override open class var resourceType: ResourceType { return .communication } + + /// Unique identifier + public var identifier: [Identifier]? + + /// Instantiates protocol or definition + public var definition: [Reference]? + + /// Request fulfilled by this communication + public var basedOn: [Reference]? + + /// Part of this action + public var partOf: [Reference]? + + /// The status of the transmission. + public var status: FHIRPrimitive + + /// Communication did not occur + public var notDone: FHIRPrimitive? + + /// Why communication did not occur + public var notDoneReason: CodeableConcept? + + /// Message category + public var category: [CodeableConcept]? + + /// A channel of communication + public var medium: [CodeableConcept]? + + /// Focus of message + public var subject: Reference? + + /// Message recipient + public var recipient: [Reference]? + + /// Focal resources + public var topic: [Reference]? + + /// Encounter or episode leading to message + public var context: Reference? + + /// When sent + public var sent: FHIRPrimitive? + + /// When received + public var received: FHIRPrimitive? + + /// Message sender + public var sender: Reference? + + /// Indication for message + public var reasonCode: [CodeableConcept]? + + /// Why was communication done? + public var reasonReference: [Reference]? + + /// Message payload + public var payload: [CommunicationPayload]? + + /// Comments made about the communication + public var note: [Annotation]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + basedOn: [Reference]? = nil, + category: [CodeableConcept]? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + medium: [CodeableConcept]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + notDone: FHIRPrimitive? = nil, + notDoneReason: CodeableConcept? = nil, + note: [Annotation]? = nil, + partOf: [Reference]? = nil, + payload: [CommunicationPayload]? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + received: FHIRPrimitive? = nil, + recipient: [Reference]? = nil, + sender: Reference? = nil, + sent: FHIRPrimitive? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil, + topic: [Reference]? = nil) + { + self.init(status: status) + self.basedOn = basedOn + self.category = category + self.contained = contained + self.context = context + self.definition = definition + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.medium = medium + self.meta = meta + self.modifierExtension = modifierExtension + self.notDone = notDone + self.notDoneReason = notDoneReason + self.note = note + self.partOf = partOf + self.payload = payload + self.reasonCode = reasonCode + self.reasonReference = reasonReference + self.received = received + self.recipient = recipient + self.sender = sender + self.sent = sent + self.subject = subject + self.text = text + self.topic = topic + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case basedOn + case category + case context + case definition + case identifier + case medium + case notDone; case _notDone + case notDoneReason + case note + case partOf + case payload + case reasonCode + case reasonReference + case received; case _received + case recipient + case sender + case sent; case _sent + case status; case _status + case subject + case topic + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.definition = try [Reference](from: _container, forKeyIfPresent: .definition) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.medium = try [CodeableConcept](from: _container, forKeyIfPresent: .medium) + self.notDone = try FHIRPrimitive(from: _container, forKeyIfPresent: .notDone, auxiliaryKey: ._notDone) + self.notDoneReason = try CodeableConcept(from: _container, forKeyIfPresent: .notDoneReason) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.partOf = try [Reference](from: _container, forKeyIfPresent: .partOf) + self.payload = try [CommunicationPayload](from: _container, forKeyIfPresent: .payload) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.received = try FHIRPrimitive(from: _container, forKeyIfPresent: .received, auxiliaryKey: ._received) + self.recipient = try [Reference](from: _container, forKeyIfPresent: .recipient) + self.sender = try Reference(from: _container, forKeyIfPresent: .sender) + self.sent = try FHIRPrimitive(from: _container, forKeyIfPresent: .sent, auxiliaryKey: ._sent) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.topic = try [Reference](from: _container, forKeyIfPresent: .topic) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try basedOn?.encode(on: &_container, forKey: .basedOn) + try category?.encode(on: &_container, forKey: .category) + try context?.encode(on: &_container, forKey: .context) + try definition?.encode(on: &_container, forKey: .definition) + try identifier?.encode(on: &_container, forKey: .identifier) + try medium?.encode(on: &_container, forKey: .medium) + try notDone?.encode(on: &_container, forKey: .notDone, auxiliaryKey: ._notDone) + try notDoneReason?.encode(on: &_container, forKey: .notDoneReason) + try note?.encode(on: &_container, forKey: .note) + try partOf?.encode(on: &_container, forKey: .partOf) + try payload?.encode(on: &_container, forKey: .payload) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try received?.encode(on: &_container, forKey: .received, auxiliaryKey: ._received) + try recipient?.encode(on: &_container, forKey: .recipient) + try sender?.encode(on: &_container, forKey: .sender) + try sent?.encode(on: &_container, forKey: .sent, auxiliaryKey: ._sent) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try topic?.encode(on: &_container, forKey: .topic) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Communication else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return basedOn == _other.basedOn + && category == _other.category + && context == _other.context + && definition == _other.definition + && identifier == _other.identifier + && medium == _other.medium + && notDone == _other.notDone + && notDoneReason == _other.notDoneReason + && note == _other.note + && partOf == _other.partOf + && payload == _other.payload + && reasonCode == _other.reasonCode + && reasonReference == _other.reasonReference + && received == _other.received + && recipient == _other.recipient + && sender == _other.sender + && sent == _other.sent + && status == _other.status + && subject == _other.subject + && topic == _other.topic + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(basedOn) + hasher.combine(category) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(identifier) + hasher.combine(medium) + hasher.combine(notDone) + hasher.combine(notDoneReason) + hasher.combine(note) + hasher.combine(partOf) + hasher.combine(payload) + hasher.combine(reasonCode) + hasher.combine(reasonReference) + hasher.combine(received) + hasher.combine(recipient) + hasher.combine(sender) + hasher.combine(sent) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(topic) + } +} + +/** + Message payload. + + Text, attachment(s), or resource(s) that was communicated to the recipient. + */ +open class CommunicationPayload: BackboneElement { + + /// All possible types for "content[x]" + public enum ContentX: Hashable { + case attachment(Attachment) + case reference(Reference) + case string(FHIRPrimitive) + } + + /// Message part content + /// One of `content[x]` + public var content: ContentX + + /// Designated initializer taking all required properties + public init(content: ContentX) { + self.content = content + super.init() + } + + /// Convenience initializer + public convenience init( + content: ContentX, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(content: content) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contentAttachment + case contentReference + case contentString; case _contentString + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.contentAttachment) || _container.contains(CodingKeys.contentReference) || _container.contains(CodingKeys.contentString) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.contentAttachment, CodingKeys.contentReference, CodingKeys.contentString], debugDescription: "Must have at least one value for \"content\" but have none")) + } + + // Decode all our properties + var _t_content: ContentX? = nil + if let contentString = try FHIRPrimitive(from: _container, forKeyIfPresent: .contentString, auxiliaryKey: ._contentString) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentString, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .string(contentString) + } + if let contentAttachment = try Attachment(from: _container, forKeyIfPresent: .contentAttachment) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentAttachment, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .attachment(contentAttachment) + } + if let contentReference = try Reference(from: _container, forKeyIfPresent: .contentReference) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentReference, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .reference(contentReference) + } + self.content = _t_content! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + + switch content { + case .string(let _value): + try _value.encode(on: &_container, forKey: .contentString, auxiliaryKey: ._contentString) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .contentAttachment) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .contentReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CommunicationPayload else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return content == _other.content + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(content) + } +} diff --git a/Sources/ModelsSTU3/CommunicationRequest.swift b/Sources/ModelsSTU3/CommunicationRequest.swift new file mode 100644 index 0000000..f562a15 --- /dev/null +++ b/Sources/ModelsSTU3/CommunicationRequest.swift @@ -0,0 +1,517 @@ +// +// CommunicationRequest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A request for information to be sent to a receiver. + + A request to convey information; e.g. the CDS system proposes that an alert be sent to a responsible provider, the CDS + system proposes that the public health agency be notified about a reportable condition. + */ +open class CommunicationRequest: DomainResource { + + override open class var resourceType: ResourceType { return .communicationRequest } + + /// All possible types for "occurrence[x]" + public enum OccurrenceX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// Unique identifier + public var identifier: [Identifier]? + + /// Fulfills plan or proposal + public var basedOn: [Reference]? + + /// Request(s) replaced by this request + public var replaces: [Reference]? + + /// Composite request this is part of + public var groupIdentifier: Identifier? + + /// The status of the proposal or order. + public var status: FHIRPrimitive + + /// Message category + public var category: [CodeableConcept]? + + /// Characterizes how quickly the proposed act must be initiated. Includes concepts such as stat, urgent, routine. + public var priority: FHIRPrimitive? + + /// A channel of communication + public var medium: [CodeableConcept]? + + /// Focus of message + public var subject: Reference? + + /// Message recipient + public var recipient: [Reference]? + + /// Focal resources + public var topic: [Reference]? + + /// Encounter or episode leading to message + public var context: Reference? + + /// Message payload + public var payload: [CommunicationRequestPayload]? + + /// When scheduled + /// One of `occurrence[x]` + public var occurrence: OccurrenceX? + + /// When request transitioned to being actionable + public var authoredOn: FHIRPrimitive? + + /// Message sender + public var sender: Reference? + + /// Who/what is requesting service + public var requester: CommunicationRequestRequester? + + /// Why is communication needed? + public var reasonCode: [CodeableConcept]? + + /// Why is communication needed? + public var reasonReference: [Reference]? + + /// Comments made about communication request + public var note: [Annotation]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + authoredOn: FHIRPrimitive? = nil, + basedOn: [Reference]? = nil, + category: [CodeableConcept]? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + `extension`: [Extension]? = nil, + groupIdentifier: Identifier? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + medium: [CodeableConcept]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + occurrence: OccurrenceX? = nil, + payload: [CommunicationRequestPayload]? = nil, + priority: FHIRPrimitive? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + recipient: [Reference]? = nil, + replaces: [Reference]? = nil, + requester: CommunicationRequestRequester? = nil, + sender: Reference? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil, + topic: [Reference]? = nil) + { + self.init(status: status) + self.authoredOn = authoredOn + self.basedOn = basedOn + self.category = category + self.contained = contained + self.context = context + self.`extension` = `extension` + self.groupIdentifier = groupIdentifier + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.medium = medium + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.occurrence = occurrence + self.payload = payload + self.priority = priority + self.reasonCode = reasonCode + self.reasonReference = reasonReference + self.recipient = recipient + self.replaces = replaces + self.requester = requester + self.sender = sender + self.subject = subject + self.text = text + self.topic = topic + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authoredOn; case _authoredOn + case basedOn + case category + case context + case groupIdentifier + case identifier + case medium + case note + case occurrenceDateTime; case _occurrenceDateTime + case occurrencePeriod + case payload + case priority; case _priority + case reasonCode + case reasonReference + case recipient + case replaces + case requester + case sender + case status; case _status + case subject + case topic + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.authoredOn = try FHIRPrimitive(from: _container, forKeyIfPresent: .authoredOn, auxiliaryKey: ._authoredOn) + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.groupIdentifier = try Identifier(from: _container, forKeyIfPresent: .groupIdentifier) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.medium = try [CodeableConcept](from: _container, forKeyIfPresent: .medium) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + var _t_occurrence: OccurrenceX? = nil + if let occurrenceDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceDateTime, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .dateTime(occurrenceDateTime) + } + if let occurrencePeriod = try Period(from: _container, forKeyIfPresent: .occurrencePeriod) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrencePeriod, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .period(occurrencePeriod) + } + self.occurrence = _t_occurrence + self.payload = try [CommunicationRequestPayload](from: _container, forKeyIfPresent: .payload) + self.priority = try FHIRPrimitive(from: _container, forKeyIfPresent: .priority, auxiliaryKey: ._priority) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.recipient = try [Reference](from: _container, forKeyIfPresent: .recipient) + self.replaces = try [Reference](from: _container, forKeyIfPresent: .replaces) + self.requester = try CommunicationRequestRequester(from: _container, forKeyIfPresent: .requester) + self.sender = try Reference(from: _container, forKeyIfPresent: .sender) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.topic = try [Reference](from: _container, forKeyIfPresent: .topic) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authoredOn?.encode(on: &_container, forKey: .authoredOn, auxiliaryKey: ._authoredOn) + try basedOn?.encode(on: &_container, forKey: .basedOn) + try category?.encode(on: &_container, forKey: .category) + try context?.encode(on: &_container, forKey: .context) + try groupIdentifier?.encode(on: &_container, forKey: .groupIdentifier) + try identifier?.encode(on: &_container, forKey: .identifier) + try medium?.encode(on: &_container, forKey: .medium) + try note?.encode(on: &_container, forKey: .note) + if let _enum = occurrence { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .occurrencePeriod) + } + } + try payload?.encode(on: &_container, forKey: .payload) + try priority?.encode(on: &_container, forKey: .priority, auxiliaryKey: ._priority) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try recipient?.encode(on: &_container, forKey: .recipient) + try replaces?.encode(on: &_container, forKey: .replaces) + try requester?.encode(on: &_container, forKey: .requester) + try sender?.encode(on: &_container, forKey: .sender) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try topic?.encode(on: &_container, forKey: .topic) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CommunicationRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authoredOn == _other.authoredOn + && basedOn == _other.basedOn + && category == _other.category + && context == _other.context + && groupIdentifier == _other.groupIdentifier + && identifier == _other.identifier + && medium == _other.medium + && note == _other.note + && occurrence == _other.occurrence + && payload == _other.payload + && priority == _other.priority + && reasonCode == _other.reasonCode + && reasonReference == _other.reasonReference + && recipient == _other.recipient + && replaces == _other.replaces + && requester == _other.requester + && sender == _other.sender + && status == _other.status + && subject == _other.subject + && topic == _other.topic + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authoredOn) + hasher.combine(basedOn) + hasher.combine(category) + hasher.combine(context) + hasher.combine(groupIdentifier) + hasher.combine(identifier) + hasher.combine(medium) + hasher.combine(note) + hasher.combine(occurrence) + hasher.combine(payload) + hasher.combine(priority) + hasher.combine(reasonCode) + hasher.combine(reasonReference) + hasher.combine(recipient) + hasher.combine(replaces) + hasher.combine(requester) + hasher.combine(sender) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(topic) + } +} + +/** + Message payload. + + Text, attachment(s), or resource(s) to be communicated to the recipient. + */ +open class CommunicationRequestPayload: BackboneElement { + + /// All possible types for "content[x]" + public enum ContentX: Hashable { + case attachment(Attachment) + case reference(Reference) + case string(FHIRPrimitive) + } + + /// Message part content + /// One of `content[x]` + public var content: ContentX + + /// Designated initializer taking all required properties + public init(content: ContentX) { + self.content = content + super.init() + } + + /// Convenience initializer + public convenience init( + content: ContentX, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(content: content) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contentAttachment + case contentReference + case contentString; case _contentString + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.contentAttachment) || _container.contains(CodingKeys.contentReference) || _container.contains(CodingKeys.contentString) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.contentAttachment, CodingKeys.contentReference, CodingKeys.contentString], debugDescription: "Must have at least one value for \"content\" but have none")) + } + + // Decode all our properties + var _t_content: ContentX? = nil + if let contentString = try FHIRPrimitive(from: _container, forKeyIfPresent: .contentString, auxiliaryKey: ._contentString) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentString, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .string(contentString) + } + if let contentAttachment = try Attachment(from: _container, forKeyIfPresent: .contentAttachment) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentAttachment, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .attachment(contentAttachment) + } + if let contentReference = try Reference(from: _container, forKeyIfPresent: .contentReference) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentReference, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .reference(contentReference) + } + self.content = _t_content! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + + switch content { + case .string(let _value): + try _value.encode(on: &_container, forKey: .contentString, auxiliaryKey: ._contentString) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .contentAttachment) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .contentReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CommunicationRequestPayload else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return content == _other.content + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(content) + } +} + +/** + Who/what is requesting service. + + The individual who initiated the request and has responsibility for its activation. + */ +open class CommunicationRequestRequester: BackboneElement { + + /// Individual making the request + public var agent: Reference + + /// Organization agent is acting for + public var onBehalfOf: Reference? + + /// Designated initializer taking all required properties + public init(agent: Reference) { + self.agent = agent + super.init() + } + + /// Convenience initializer + public convenience init( + agent: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil) + { + self.init(agent: agent) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case agent + case onBehalfOf + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.agent = try Reference(from: _container, forKey: .agent) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try agent.encode(on: &_container, forKey: .agent) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CommunicationRequestRequester else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return agent == _other.agent + && onBehalfOf == _other.onBehalfOf + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(agent) + hasher.combine(onBehalfOf) + } +} diff --git a/Sources/ModelsSTU3/CompartmentDefinition.swift b/Sources/ModelsSTU3/CompartmentDefinition.swift new file mode 100644 index 0000000..1deea2f --- /dev/null +++ b/Sources/ModelsSTU3/CompartmentDefinition.swift @@ -0,0 +1,334 @@ +// +// CompartmentDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Compartment Definition for a resource. + + A compartment definition that defines how resources are accessed on a server. + */ +open class CompartmentDefinition: DomainResource { + + override open class var resourceType: ResourceType { return .compartmentDefinition } + + /// Logical URI to reference this compartment definition (globally unique) + public var url: FHIRPrimitive + + /// Name for this compartment definition (computer friendly) + public var name: FHIRPrimitive + + /// Name for this compartment definition (human friendly) + public var title: FHIRPrimitive? + + /// The status of this compartment definition. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the compartment definition + public var description_fhir: FHIRPrimitive? + + /// Why this compartment definition is defined + public var purpose: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for compartment definition (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Which compartment this definition describes. + public var code: FHIRPrimitive + + /// Whether the search syntax is supported + public var search: FHIRPrimitive + + /// How a resource is related to the compartment + public var resource: [CompartmentDefinitionResource]? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, name: FHIRPrimitive, search: FHIRPrimitive, status: FHIRPrimitive, url: FHIRPrimitive) { + self.code = code + self.name = name + self.search = search + self.status = status + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + resource: [CompartmentDefinitionResource]? = nil, + search: FHIRPrimitive, + status: FHIRPrimitive, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive, + useContext: [UsageContext]? = nil) + { + self.init(code: code, name: name, search: search, status: status, url: url) + self.contact = contact + self.contained = contained + self.date = date + self.description_fhir = description_fhir + self.experimental = experimental + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.publisher = publisher + self.purpose = purpose + self.resource = resource + self.text = text + self.title = title + self.useContext = useContext + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case contact + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case experimental; case _experimental + case jurisdiction + case name; case _name + case publisher; case _publisher + case purpose; case _purpose + case resource + case search; case _search + case status; case _status + case title; case _title + case url; case _url + case useContext + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.resource = try [CompartmentDefinitionResource](from: _container, forKeyIfPresent: .resource) + self.search = try FHIRPrimitive(from: _container, forKey: .search, auxiliaryKey: ._search) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try contact?.encode(on: &_container, forKey: .contact) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try resource?.encode(on: &_container, forKey: .resource) + try search.encode(on: &_container, forKey: .search, auxiliaryKey: ._search) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CompartmentDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && contact == _other.contact + && date == _other.date + && description_fhir == _other.description_fhir + && experimental == _other.experimental + && jurisdiction == _other.jurisdiction + && name == _other.name + && publisher == _other.publisher + && purpose == _other.purpose + && resource == _other.resource + && search == _other.search + && status == _other.status + && title == _other.title + && url == _other.url + && useContext == _other.useContext + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(contact) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(experimental) + hasher.combine(jurisdiction) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(resource) + hasher.combine(search) + hasher.combine(status) + hasher.combine(title) + hasher.combine(url) + hasher.combine(useContext) + } +} + +/** + How a resource is related to the compartment. + + Information about how a resource is related to the compartment. + */ +open class CompartmentDefinitionResource: BackboneElement { + + /// The name of a resource supported by the server. + public var code: FHIRPrimitive + + /// Search Parameter Name, or chained parameters + public var param: [FHIRPrimitive]? + + /// Additional documentation about the resource and compartment + public var documentation: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + param: [FHIRPrimitive]? = nil) + { + self.init(code: code) + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.param = param + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case documentation; case _documentation + case param; case _param + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.param = try [FHIRPrimitive](from: _container, forKeyIfPresent: .param, auxiliaryKey: ._param) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try param?.encode(on: &_container, forKey: .param, auxiliaryKey: ._param) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CompartmentDefinitionResource else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && documentation == _other.documentation + && param == _other.param + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(documentation) + hasher.combine(param) + } +} diff --git a/Sources/ModelsSTU3/Composition.swift b/Sources/ModelsSTU3/Composition.swift new file mode 100644 index 0000000..d475b8a --- /dev/null +++ b/Sources/ModelsSTU3/Composition.swift @@ -0,0 +1,686 @@ +// +// Composition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Composition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A set of resources composed into a single coherent clinical statement with clinical attestation. + + A set of healthcare-related information that is assembled together into a single logical document that provides a + single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who + is making the statement. While a Composition defines the structure, it does not actually contain the content: rather + the full content of a document is contained in a Bundle, of which the Composition is the first resource contained. + */ +open class Composition: DomainResource { + + override open class var resourceType: ResourceType { return .composition } + + /// Logical identifier of composition (version-independent) + public var identifier: Identifier? + + /// The workflow/clinical status of this composition. The status is a marker for the clinical standing of the + /// document. + public var status: FHIRPrimitive + + /// Kind of composition (LOINC if possible) + public var type: CodeableConcept + + /// Categorization of Composition + public var `class`: CodeableConcept? + + /// Who and/or what the composition is about + public var subject: Reference + + /// Context of the Composition + public var encounter: Reference? + + /// Composition editing time + public var date: FHIRPrimitive + + /// Who and/or what authored the composition + public var author: [Reference] + + /// Human Readable name/title + public var title: FHIRPrimitive + + /// As defined by affinity domain + public var confidentiality: FHIRPrimitive? + + /// Attests to accuracy of composition + public var attester: [CompositionAttester]? + + /// Organization which maintains the composition + public var custodian: Reference? + + /// Relationships to other compositions/documents + public var relatesTo: [CompositionRelatesTo]? + + /// The clinical service(s) being documented + public var event: [CompositionEvent]? + + /// Composition is broken into sections + public var section: [CompositionSection]? + + /// Designated initializer taking all required properties + public init(author: [Reference], date: FHIRPrimitive, status: FHIRPrimitive, subject: Reference, title: FHIRPrimitive, type: CodeableConcept) { + self.author = author + self.date = date + self.status = status + self.subject = subject + self.title = title + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + attester: [CompositionAttester]? = nil, + author: [Reference], + `class`: CodeableConcept? = nil, + confidentiality: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + custodian: Reference? = nil, + date: FHIRPrimitive, + encounter: Reference? = nil, + event: [CompositionEvent]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + relatesTo: [CompositionRelatesTo]? = nil, + section: [CompositionSection]? = nil, + status: FHIRPrimitive, + subject: Reference, + text: Narrative? = nil, + title: FHIRPrimitive, + type: CodeableConcept) + { + self.init(author: author, date: date, status: status, subject: subject, title: title, type: type) + self.attester = attester + self.`class` = `class` + self.confidentiality = confidentiality + self.contained = contained + self.custodian = custodian + self.encounter = encounter + self.event = event + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.relatesTo = relatesTo + self.section = section + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case attester + case author + case `class` = "class" + case confidentiality; case _confidentiality + case custodian + case date; case _date + case encounter + case event + case identifier + case relatesTo + case section + case status; case _status + case subject + case title; case _title + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.attester = try [CompositionAttester](from: _container, forKeyIfPresent: .attester) + self.author = try [Reference](from: _container, forKey: .author) + self.`class` = try CodeableConcept(from: _container, forKeyIfPresent: .`class`) + self.confidentiality = try FHIRPrimitive(from: _container, forKeyIfPresent: .confidentiality, auxiliaryKey: ._confidentiality) + self.custodian = try Reference(from: _container, forKeyIfPresent: .custodian) + self.date = try FHIRPrimitive(from: _container, forKey: .date, auxiliaryKey: ._date) + self.encounter = try Reference(from: _container, forKeyIfPresent: .encounter) + self.event = try [CompositionEvent](from: _container, forKeyIfPresent: .event) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.relatesTo = try [CompositionRelatesTo](from: _container, forKeyIfPresent: .relatesTo) + self.section = try [CompositionSection](from: _container, forKeyIfPresent: .section) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.title = try FHIRPrimitive(from: _container, forKey: .title, auxiliaryKey: ._title) + self.type = try CodeableConcept(from: _container, forKey: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try attester?.encode(on: &_container, forKey: .attester) + try author.encode(on: &_container, forKey: .author) + try `class`?.encode(on: &_container, forKey: .`class`) + try confidentiality?.encode(on: &_container, forKey: .confidentiality, auxiliaryKey: ._confidentiality) + try custodian?.encode(on: &_container, forKey: .custodian) + try date.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try encounter?.encode(on: &_container, forKey: .encounter) + try event?.encode(on: &_container, forKey: .event) + try identifier?.encode(on: &_container, forKey: .identifier) + try relatesTo?.encode(on: &_container, forKey: .relatesTo) + try section?.encode(on: &_container, forKey: .section) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try title.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try type.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Composition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return attester == _other.attester + && author == _other.author + && `class` == _other.`class` + && confidentiality == _other.confidentiality + && custodian == _other.custodian + && date == _other.date + && encounter == _other.encounter + && event == _other.event + && identifier == _other.identifier + && relatesTo == _other.relatesTo + && section == _other.section + && status == _other.status + && subject == _other.subject + && title == _other.title + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(attester) + hasher.combine(author) + hasher.combine(`class`) + hasher.combine(confidentiality) + hasher.combine(custodian) + hasher.combine(date) + hasher.combine(encounter) + hasher.combine(event) + hasher.combine(identifier) + hasher.combine(relatesTo) + hasher.combine(section) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(title) + hasher.combine(type) + } +} + +/** + Attests to accuracy of composition. + + A participant who has attested to the accuracy of the composition/document. + */ +open class CompositionAttester: BackboneElement { + + /// The type of attestation the authenticator offers. + public var mode: [FHIRPrimitive] + + /// When the composition was attested + public var time: FHIRPrimitive? + + /// Who attested the composition + public var party: Reference? + + /// Designated initializer taking all required properties + public init(mode: [FHIRPrimitive]) { + self.mode = mode + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + mode: [FHIRPrimitive], + modifierExtension: [Extension]? = nil, + party: Reference? = nil, + time: FHIRPrimitive? = nil) + { + self.init(mode: mode) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.party = party + self.time = time + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case mode; case _mode + case party + case time; case _time + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.mode = try [FHIRPrimitive](from: _container, forKey: .mode, auxiliaryKey: ._mode) + self.party = try Reference(from: _container, forKeyIfPresent: .party) + self.time = try FHIRPrimitive(from: _container, forKeyIfPresent: .time, auxiliaryKey: ._time) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try mode.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try party?.encode(on: &_container, forKey: .party) + try time?.encode(on: &_container, forKey: .time, auxiliaryKey: ._time) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CompositionAttester else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return mode == _other.mode + && party == _other.party + && time == _other.time + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(mode) + hasher.combine(party) + hasher.combine(time) + } +} + +/** + The clinical service(s) being documented. + + The clinical service, such as a colonoscopy or an appendectomy, being documented. + */ +open class CompositionEvent: BackboneElement { + + /// Code(s) that apply to the event being documented + public var code: [CodeableConcept]? + + /// The period covered by the documentation + public var period: Period? + + /// The event(s) being documented + public var detail: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: [CodeableConcept]? = nil, + detail: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil) + { + self.init() + self.code = code + self.detail = detail + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.period = period + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case detail + case period + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try [CodeableConcept](from: _container, forKeyIfPresent: .code) + self.detail = try [Reference](from: _container, forKeyIfPresent: .detail) + self.period = try Period(from: _container, forKeyIfPresent: .period) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try detail?.encode(on: &_container, forKey: .detail) + try period?.encode(on: &_container, forKey: .period) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CompositionEvent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && detail == _other.detail + && period == _other.period + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(detail) + hasher.combine(period) + } +} + +/** + Relationships to other compositions/documents. + + Relationships that this composition has with other compositions or documents that already exist. + */ +open class CompositionRelatesTo: BackboneElement { + + /// All possible types for "target[x]" + public enum TargetX: Hashable { + case identifier(Identifier) + case reference(Reference) + } + + /// The type of relationship that this composition has with anther composition or document. + public var code: FHIRPrimitive + + /// Target of the relationship + /// One of `target[x]` + public var target: TargetX + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, target: TargetX) { + self.code = code + self.target = target + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + target: TargetX) + { + self.init(code: code, target: target) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case targetIdentifier + case targetReference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.targetIdentifier) || _container.contains(CodingKeys.targetReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.targetIdentifier, CodingKeys.targetReference], debugDescription: "Must have at least one value for \"target\" but have none")) + } + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + var _t_target: TargetX? = nil + if let targetIdentifier = try Identifier(from: _container, forKeyIfPresent: .targetIdentifier) { + if _t_target != nil { + throw DecodingError.dataCorruptedError(forKey: .targetIdentifier, in: _container, debugDescription: "More than one value provided for \"target\"") + } + _t_target = .identifier(targetIdentifier) + } + if let targetReference = try Reference(from: _container, forKeyIfPresent: .targetReference) { + if _t_target != nil { + throw DecodingError.dataCorruptedError(forKey: .targetReference, in: _container, debugDescription: "More than one value provided for \"target\"") + } + _t_target = .reference(targetReference) + } + self.target = _t_target! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + + switch target { + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .targetIdentifier) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .targetReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CompositionRelatesTo else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(target) + } +} + +/** + Composition is broken into sections. + + The root of the sections that make up the composition. + */ +open class CompositionSection: BackboneElement { + + /// Label for section (e.g. for ToC) + public var title: FHIRPrimitive? + + /// Classification of section (recommended) + public var code: CodeableConcept? + + /// Text summary of the section, for human interpretation + public var text: Narrative? + + /// How the entry list was prepared - whether it is a working list that is suitable for being maintained on an + /// ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a + /// prepared list where items may be marked as added, modified or deleted. + public var mode: FHIRPrimitive? + + /// Order of section entries + public var orderedBy: CodeableConcept? + + /// A reference to data that supports this section + public var entry: [Reference]? + + /// Why the section is empty + public var emptyReason: CodeableConcept? + + /// Nested Section + public var section: [CompositionSection]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept? = nil, + emptyReason: CodeableConcept? = nil, + entry: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + mode: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + orderedBy: CodeableConcept? = nil, + section: [CompositionSection]? = nil, + text: Narrative? = nil, + title: FHIRPrimitive? = nil) + { + self.init() + self.code = code + self.emptyReason = emptyReason + self.entry = entry + self.`extension` = `extension` + self.id = id + self.mode = mode + self.modifierExtension = modifierExtension + self.orderedBy = orderedBy + self.section = section + self.text = text + self.title = title + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case emptyReason + case entry + case mode; case _mode + case orderedBy + case section + case text + case title; case _title + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.emptyReason = try CodeableConcept(from: _container, forKeyIfPresent: .emptyReason) + self.entry = try [Reference](from: _container, forKeyIfPresent: .entry) + self.mode = try FHIRPrimitive(from: _container, forKeyIfPresent: .mode, auxiliaryKey: ._mode) + self.orderedBy = try CodeableConcept(from: _container, forKeyIfPresent: .orderedBy) + self.section = try [CompositionSection](from: _container, forKeyIfPresent: .section) + self.text = try Narrative(from: _container, forKeyIfPresent: .text) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try emptyReason?.encode(on: &_container, forKey: .emptyReason) + try entry?.encode(on: &_container, forKey: .entry) + try mode?.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try orderedBy?.encode(on: &_container, forKey: .orderedBy) + try section?.encode(on: &_container, forKey: .section) + try text?.encode(on: &_container, forKey: .text) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CompositionSection else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && emptyReason == _other.emptyReason + && entry == _other.entry + && mode == _other.mode + && orderedBy == _other.orderedBy + && section == _other.section + && text == _other.text + && title == _other.title + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(emptyReason) + hasher.combine(entry) + hasher.combine(mode) + hasher.combine(orderedBy) + hasher.combine(section) + hasher.combine(text) + hasher.combine(title) + } +} diff --git a/Sources/ModelsSTU3/ConceptMap.swift b/Sources/ModelsSTU3/ConceptMap.swift new file mode 100644 index 0000000..8dcbdaf --- /dev/null +++ b/Sources/ModelsSTU3/ConceptMap.swift @@ -0,0 +1,869 @@ +// +// ConceptMap.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ConceptMap) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A map from one set of concepts to one or more other concepts. + + A statement of relationships from one set of concepts to one or more other concepts - either code systems or data + elements, or classes in class models. + */ +open class ConceptMap: DomainResource { + + override open class var resourceType: ResourceType { return .conceptMap } + + /// All possible types for "source[x]" + public enum SourceX: Hashable { + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// All possible types for "target[x]" + public enum TargetX: Hashable { + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// Logical URI to reference this concept map (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the concept map + public var identifier: Identifier? + + /// Business version of the concept map + public var version: FHIRPrimitive? + + /// Name for this concept map (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this concept map (human friendly) + public var title: FHIRPrimitive? + + /// The status of this concept map. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the concept map + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for concept map (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Why this concept map is defined + public var purpose: FHIRPrimitive? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Identifies the source of the concepts which are being mapped + /// One of `source[x]` + public var source: SourceX? + + /// Provides context to the mappings + /// One of `target[x]` + public var target: TargetX? + + /// Same source and target systems + public var group: [ConceptMapGroup]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + group: [ConceptMapGroup]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + source: SourceX? = nil, + status: FHIRPrimitive, + target: TargetX? = nil, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(status: status) + self.contact = contact + self.contained = contained + self.copyright = copyright + self.date = date + self.description_fhir = description_fhir + self.experimental = experimental + self.`extension` = `extension` + self.group = group + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.publisher = publisher + self.purpose = purpose + self.source = source + self.target = target + self.text = text + self.title = title + self.url = url + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contact + case copyright; case _copyright + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case experimental; case _experimental + case group + case identifier + case jurisdiction + case name; case _name + case publisher; case _publisher + case purpose; case _purpose + case sourceReference + case sourceUri; case _sourceUri + case status; case _status + case targetReference + case targetUri; case _targetUri + case title; case _title + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.group = try [ConceptMapGroup](from: _container, forKeyIfPresent: .group) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + var _t_source: SourceX? = nil + if let sourceUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .sourceUri, auxiliaryKey: ._sourceUri) { + if _t_source != nil { + throw DecodingError.dataCorruptedError(forKey: .sourceUri, in: _container, debugDescription: "More than one value provided for \"source\"") + } + _t_source = .uri(sourceUri) + } + if let sourceReference = try Reference(from: _container, forKeyIfPresent: .sourceReference) { + if _t_source != nil { + throw DecodingError.dataCorruptedError(forKey: .sourceReference, in: _container, debugDescription: "More than one value provided for \"source\"") + } + _t_source = .reference(sourceReference) + } + self.source = _t_source + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + var _t_target: TargetX? = nil + if let targetUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .targetUri, auxiliaryKey: ._targetUri) { + if _t_target != nil { + throw DecodingError.dataCorruptedError(forKey: .targetUri, in: _container, debugDescription: "More than one value provided for \"target\"") + } + _t_target = .uri(targetUri) + } + if let targetReference = try Reference(from: _container, forKeyIfPresent: .targetReference) { + if _t_target != nil { + throw DecodingError.dataCorruptedError(forKey: .targetReference, in: _container, debugDescription: "More than one value provided for \"target\"") + } + _t_target = .reference(targetReference) + } + self.target = _t_target + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contact?.encode(on: &_container, forKey: .contact) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try group?.encode(on: &_container, forKey: .group) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + if let _enum = source { + switch _enum { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .sourceUri, auxiliaryKey: ._sourceUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .sourceReference) + } + } + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + if let _enum = target { + switch _enum { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .targetUri, auxiliaryKey: ._targetUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .targetReference) + } + } + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConceptMap else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contact == _other.contact + && copyright == _other.copyright + && date == _other.date + && description_fhir == _other.description_fhir + && experimental == _other.experimental + && group == _other.group + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && name == _other.name + && publisher == _other.publisher + && purpose == _other.purpose + && source == _other.source + && status == _other.status + && target == _other.target + && title == _other.title + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contact) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(experimental) + hasher.combine(group) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(source) + hasher.combine(status) + hasher.combine(target) + hasher.combine(title) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Same source and target systems. + + A group of mappings that all have the same source and target system. + */ +open class ConceptMapGroup: BackboneElement { + + /// Code System (if value set crosses code systems) + public var source: FHIRPrimitive? + + /// Specific version of the code system + public var sourceVersion: FHIRPrimitive? + + /// System of the target (if necessary) + public var target: FHIRPrimitive? + + /// Specific version of the code system + public var targetVersion: FHIRPrimitive? + + /// Mappings for a concept from the source set + public var element: [ConceptMapGroupElement] + + /// When no match in the mappings + public var unmapped: ConceptMapGroupUnmapped? + + /// Designated initializer taking all required properties + public init(element: [ConceptMapGroupElement]) { + self.element = element + super.init() + } + + /// Convenience initializer + public convenience init( + element: [ConceptMapGroupElement], + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + source: FHIRPrimitive? = nil, + sourceVersion: FHIRPrimitive? = nil, + target: FHIRPrimitive? = nil, + targetVersion: FHIRPrimitive? = nil, + unmapped: ConceptMapGroupUnmapped? = nil) + { + self.init(element: element) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.source = source + self.sourceVersion = sourceVersion + self.target = target + self.targetVersion = targetVersion + self.unmapped = unmapped + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case element + case source; case _source + case sourceVersion; case _sourceVersion + case target; case _target + case targetVersion; case _targetVersion + case unmapped + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.element = try [ConceptMapGroupElement](from: _container, forKey: .element) + self.source = try FHIRPrimitive(from: _container, forKeyIfPresent: .source, auxiliaryKey: ._source) + self.sourceVersion = try FHIRPrimitive(from: _container, forKeyIfPresent: .sourceVersion, auxiliaryKey: ._sourceVersion) + self.target = try FHIRPrimitive(from: _container, forKeyIfPresent: .target, auxiliaryKey: ._target) + self.targetVersion = try FHIRPrimitive(from: _container, forKeyIfPresent: .targetVersion, auxiliaryKey: ._targetVersion) + self.unmapped = try ConceptMapGroupUnmapped(from: _container, forKeyIfPresent: .unmapped) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try element.encode(on: &_container, forKey: .element) + try source?.encode(on: &_container, forKey: .source, auxiliaryKey: ._source) + try sourceVersion?.encode(on: &_container, forKey: .sourceVersion, auxiliaryKey: ._sourceVersion) + try target?.encode(on: &_container, forKey: .target, auxiliaryKey: ._target) + try targetVersion?.encode(on: &_container, forKey: .targetVersion, auxiliaryKey: ._targetVersion) + try unmapped?.encode(on: &_container, forKey: .unmapped) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConceptMapGroup else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return element == _other.element + && source == _other.source + && sourceVersion == _other.sourceVersion + && target == _other.target + && targetVersion == _other.targetVersion + && unmapped == _other.unmapped + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(element) + hasher.combine(source) + hasher.combine(sourceVersion) + hasher.combine(target) + hasher.combine(targetVersion) + hasher.combine(unmapped) + } +} + +/** + Mappings for a concept from the source set. + + Mappings for an individual concept in the source to one or more concepts in the target. + */ +open class ConceptMapGroupElement: BackboneElement { + + /// Identifies element being mapped + public var code: FHIRPrimitive? + + /// Display for the code + public var display: FHIRPrimitive? + + /// Concept in target system for element + public var target: [ConceptMapGroupElementTarget]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive? = nil, + display: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + target: [ConceptMapGroupElementTarget]? = nil) + { + self.init() + self.code = code + self.display = display + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.target = target + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case display; case _display + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKeyIfPresent: .code, auxiliaryKey: ._code) + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + self.target = try [ConceptMapGroupElementTarget](from: _container, forKeyIfPresent: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try target?.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConceptMapGroupElement else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && display == _other.display + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(display) + hasher.combine(target) + } +} + +/** + Concept in target system for element. + + A concept from the target value set that this concept maps to. + */ +open class ConceptMapGroupElementTarget: BackboneElement { + + /// Code that identifies the target element + public var code: FHIRPrimitive? + + /// Display for the code + public var display: FHIRPrimitive? + + /// The equivalence between the source and target concepts (counting for the dependencies and products). The + /// equivalence is read from target to source (e.g. the target is 'wider' than the source). + public var equivalence: FHIRPrimitive? + + /// Description of status/issues in mapping + public var comment: FHIRPrimitive? + + /// Other elements required for this mapping (from context) + public var dependsOn: [ConceptMapGroupElementTargetDependsOn]? + + /// Other concepts that this mapping also produces + public var product: [ConceptMapGroupElementTargetDependsOn]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive? = nil, + comment: FHIRPrimitive? = nil, + dependsOn: [ConceptMapGroupElementTargetDependsOn]? = nil, + display: FHIRPrimitive? = nil, + equivalence: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + product: [ConceptMapGroupElementTargetDependsOn]? = nil) + { + self.init() + self.code = code + self.comment = comment + self.dependsOn = dependsOn + self.display = display + self.equivalence = equivalence + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.product = product + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case comment; case _comment + case dependsOn + case display; case _display + case equivalence; case _equivalence + case product + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKeyIfPresent: .code, auxiliaryKey: ._code) + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.dependsOn = try [ConceptMapGroupElementTargetDependsOn](from: _container, forKeyIfPresent: .dependsOn) + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + self.equivalence = try FHIRPrimitive(from: _container, forKeyIfPresent: .equivalence, auxiliaryKey: ._equivalence) + self.product = try [ConceptMapGroupElementTargetDependsOn](from: _container, forKeyIfPresent: .product) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try dependsOn?.encode(on: &_container, forKey: .dependsOn) + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try equivalence?.encode(on: &_container, forKey: .equivalence, auxiliaryKey: ._equivalence) + try product?.encode(on: &_container, forKey: .product) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConceptMapGroupElementTarget else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && comment == _other.comment + && dependsOn == _other.dependsOn + && display == _other.display + && equivalence == _other.equivalence + && product == _other.product + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(comment) + hasher.combine(dependsOn) + hasher.combine(display) + hasher.combine(equivalence) + hasher.combine(product) + } +} + +/** + Other elements required for this mapping (from context). + + A set of additional dependencies for this mapping to hold. This mapping is only applicable if the specified element can + be resolved, and it has the specified value. + */ +open class ConceptMapGroupElementTargetDependsOn: BackboneElement { + + /// Reference to property mapping depends on + public var property: FHIRPrimitive + + /// Code System (if necessary) + public var system: FHIRPrimitive? + + /// Value of the referenced element + public var code: FHIRPrimitive + + /// Display for the code + public var display: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, property: FHIRPrimitive) { + self.code = code + self.property = property + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + display: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + property: FHIRPrimitive, + system: FHIRPrimitive? = nil) + { + self.init(code: code, property: property) + self.display = display + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.system = system + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case display; case _display + case property; case _property + case system; case _system + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + self.property = try FHIRPrimitive(from: _container, forKey: .property, auxiliaryKey: ._property) + self.system = try FHIRPrimitive(from: _container, forKeyIfPresent: .system, auxiliaryKey: ._system) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try property.encode(on: &_container, forKey: .property, auxiliaryKey: ._property) + try system?.encode(on: &_container, forKey: .system, auxiliaryKey: ._system) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConceptMapGroupElementTargetDependsOn else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && display == _other.display + && property == _other.property + && system == _other.system + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(display) + hasher.combine(property) + hasher.combine(system) + } +} + +/** + When no match in the mappings. + + What to do when there is no match in the mappings in the group. + */ +open class ConceptMapGroupUnmapped: BackboneElement { + + /// Defines which action to take if there is no match in the group. One of 3 actions is possible: use the unmapped + /// code (this is useful when doing a mapping between versions, and only a few codes have changed), use a fixed code + /// (a default code), or alternatively, a reference to a different concept map can be provided (by canonical URL). + public var mode: FHIRPrimitive + + /// Fixed code when mode = fixed + public var code: FHIRPrimitive? + + /// Display for the code + public var display: FHIRPrimitive? + + /// Canonical URL for other concept map + public var url: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(mode: FHIRPrimitive) { + self.mode = mode + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive? = nil, + display: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + mode: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + url: FHIRPrimitive? = nil) + { + self.init(mode: mode) + self.code = code + self.display = display + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.url = url + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case display; case _display + case mode; case _mode + case url; case _url + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKeyIfPresent: .code, auxiliaryKey: ._code) + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + self.mode = try FHIRPrimitive(from: _container, forKey: .mode, auxiliaryKey: ._mode) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try mode.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConceptMapGroupUnmapped else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && display == _other.display + && mode == _other.mode + && url == _other.url + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(display) + hasher.combine(mode) + hasher.combine(url) + } +} diff --git a/Sources/ModelsSTU3/Condition.swift b/Sources/ModelsSTU3/Condition.swift new file mode 100644 index 0000000..2558ad8 --- /dev/null +++ b/Sources/ModelsSTU3/Condition.swift @@ -0,0 +1,542 @@ +// +// Condition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Condition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Detailed information about conditions, problems or diagnoses. + + A clinical condition, problem, diagnosis, or other event, situation, issue, or clinical concept that has risen to a + level of concern. + */ +open class Condition: DomainResource { + + override open class var resourceType: ResourceType { return .condition } + + /// All possible types for "abatement[x]" + public enum AbatementX: Hashable { + case age(Age) + case boolean(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case period(Period) + case range(Range) + case string(FHIRPrimitive) + } + + /// All possible types for "onset[x]" + public enum OnsetX: Hashable { + case age(Age) + case dateTime(FHIRPrimitive) + case period(Period) + case range(Range) + case string(FHIRPrimitive) + } + + /// External Ids for this condition + public var identifier: [Identifier]? + + /// active | recurrence | inactive | remission | resolved + public var clinicalStatus: FHIRPrimitive? + + /// The verification status to support the clinical status of the condition. + public var verificationStatus: FHIRPrimitive? + + /// problem-list-item | encounter-diagnosis + public var category: [CodeableConcept]? + + /// Subjective severity of condition + public var severity: CodeableConcept? + + /// Identification of the condition, problem or diagnosis + public var code: CodeableConcept? + + /// Anatomical location, if relevant + public var bodySite: [CodeableConcept]? + + /// Who has the condition? + public var subject: Reference + + /// Encounter or episode when condition first asserted + public var context: Reference? + + /// Estimated or actual date, date-time, or age + /// One of `onset[x]` + public var onset: OnsetX? + + /// If/when in resolution/remission + /// One of `abatement[x]` + public var abatement: AbatementX? + + /// Date record was believed accurate + public var assertedDate: FHIRPrimitive? + + /// Person who asserts this condition + public var asserter: Reference? + + /// Stage/grade, usually assessed formally + public var stage: ConditionStage? + + /// Supporting evidence + public var evidence: [ConditionEvidence]? + + /// Additional information about the Condition + public var note: [Annotation]? + + /// Designated initializer taking all required properties + public init(subject: Reference) { + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + abatement: AbatementX? = nil, + assertedDate: FHIRPrimitive? = nil, + asserter: Reference? = nil, + bodySite: [CodeableConcept]? = nil, + category: [CodeableConcept]? = nil, + clinicalStatus: FHIRPrimitive? = nil, + code: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + evidence: [ConditionEvidence]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + onset: OnsetX? = nil, + severity: CodeableConcept? = nil, + stage: ConditionStage? = nil, + subject: Reference, + text: Narrative? = nil, + verificationStatus: FHIRPrimitive? = nil) + { + self.init(subject: subject) + self.abatement = abatement + self.assertedDate = assertedDate + self.asserter = asserter + self.bodySite = bodySite + self.category = category + self.clinicalStatus = clinicalStatus + self.code = code + self.contained = contained + self.context = context + self.evidence = evidence + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.onset = onset + self.severity = severity + self.stage = stage + self.text = text + self.verificationStatus = verificationStatus + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case abatementAge + case abatementBoolean; case _abatementBoolean + case abatementDateTime; case _abatementDateTime + case abatementPeriod + case abatementRange + case abatementString; case _abatementString + case assertedDate; case _assertedDate + case asserter + case bodySite + case category + case clinicalStatus; case _clinicalStatus + case code + case context + case evidence + case identifier + case note + case onsetAge + case onsetDateTime; case _onsetDateTime + case onsetPeriod + case onsetRange + case onsetString; case _onsetString + case severity + case stage + case subject + case verificationStatus; case _verificationStatus + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_abatement: AbatementX? = nil + if let abatementDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .abatementDateTime, auxiliaryKey: ._abatementDateTime) { + if _t_abatement != nil { + throw DecodingError.dataCorruptedError(forKey: .abatementDateTime, in: _container, debugDescription: "More than one value provided for \"abatement\"") + } + _t_abatement = .dateTime(abatementDateTime) + } + if let abatementAge = try Age(from: _container, forKeyIfPresent: .abatementAge) { + if _t_abatement != nil { + throw DecodingError.dataCorruptedError(forKey: .abatementAge, in: _container, debugDescription: "More than one value provided for \"abatement\"") + } + _t_abatement = .age(abatementAge) + } + if let abatementBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .abatementBoolean, auxiliaryKey: ._abatementBoolean) { + if _t_abatement != nil { + throw DecodingError.dataCorruptedError(forKey: .abatementBoolean, in: _container, debugDescription: "More than one value provided for \"abatement\"") + } + _t_abatement = .boolean(abatementBoolean) + } + if let abatementPeriod = try Period(from: _container, forKeyIfPresent: .abatementPeriod) { + if _t_abatement != nil { + throw DecodingError.dataCorruptedError(forKey: .abatementPeriod, in: _container, debugDescription: "More than one value provided for \"abatement\"") + } + _t_abatement = .period(abatementPeriod) + } + if let abatementRange = try Range(from: _container, forKeyIfPresent: .abatementRange) { + if _t_abatement != nil { + throw DecodingError.dataCorruptedError(forKey: .abatementRange, in: _container, debugDescription: "More than one value provided for \"abatement\"") + } + _t_abatement = .range(abatementRange) + } + if let abatementString = try FHIRPrimitive(from: _container, forKeyIfPresent: .abatementString, auxiliaryKey: ._abatementString) { + if _t_abatement != nil { + throw DecodingError.dataCorruptedError(forKey: .abatementString, in: _container, debugDescription: "More than one value provided for \"abatement\"") + } + _t_abatement = .string(abatementString) + } + self.abatement = _t_abatement + self.assertedDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .assertedDate, auxiliaryKey: ._assertedDate) + self.asserter = try Reference(from: _container, forKeyIfPresent: .asserter) + self.bodySite = try [CodeableConcept](from: _container, forKeyIfPresent: .bodySite) + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.clinicalStatus = try FHIRPrimitive(from: _container, forKeyIfPresent: .clinicalStatus, auxiliaryKey: ._clinicalStatus) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.evidence = try [ConditionEvidence](from: _container, forKeyIfPresent: .evidence) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + var _t_onset: OnsetX? = nil + if let onsetDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .onsetDateTime, auxiliaryKey: ._onsetDateTime) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetDateTime, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .dateTime(onsetDateTime) + } + if let onsetAge = try Age(from: _container, forKeyIfPresent: .onsetAge) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetAge, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .age(onsetAge) + } + if let onsetPeriod = try Period(from: _container, forKeyIfPresent: .onsetPeriod) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetPeriod, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .period(onsetPeriod) + } + if let onsetRange = try Range(from: _container, forKeyIfPresent: .onsetRange) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetRange, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .range(onsetRange) + } + if let onsetString = try FHIRPrimitive(from: _container, forKeyIfPresent: .onsetString, auxiliaryKey: ._onsetString) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetString, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .string(onsetString) + } + self.onset = _t_onset + self.severity = try CodeableConcept(from: _container, forKeyIfPresent: .severity) + self.stage = try ConditionStage(from: _container, forKeyIfPresent: .stage) + self.subject = try Reference(from: _container, forKey: .subject) + self.verificationStatus = try FHIRPrimitive(from: _container, forKeyIfPresent: .verificationStatus, auxiliaryKey: ._verificationStatus) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = abatement { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .abatementDateTime, auxiliaryKey: ._abatementDateTime) + case .age(let _value): + try _value.encode(on: &_container, forKey: .abatementAge) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .abatementBoolean, auxiliaryKey: ._abatementBoolean) + case .period(let _value): + try _value.encode(on: &_container, forKey: .abatementPeriod) + case .range(let _value): + try _value.encode(on: &_container, forKey: .abatementRange) + case .string(let _value): + try _value.encode(on: &_container, forKey: .abatementString, auxiliaryKey: ._abatementString) + } + } + try assertedDate?.encode(on: &_container, forKey: .assertedDate, auxiliaryKey: ._assertedDate) + try asserter?.encode(on: &_container, forKey: .asserter) + try bodySite?.encode(on: &_container, forKey: .bodySite) + try category?.encode(on: &_container, forKey: .category) + try clinicalStatus?.encode(on: &_container, forKey: .clinicalStatus, auxiliaryKey: ._clinicalStatus) + try code?.encode(on: &_container, forKey: .code) + try context?.encode(on: &_container, forKey: .context) + try evidence?.encode(on: &_container, forKey: .evidence) + try identifier?.encode(on: &_container, forKey: .identifier) + try note?.encode(on: &_container, forKey: .note) + if let _enum = onset { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .onsetDateTime, auxiliaryKey: ._onsetDateTime) + case .age(let _value): + try _value.encode(on: &_container, forKey: .onsetAge) + case .period(let _value): + try _value.encode(on: &_container, forKey: .onsetPeriod) + case .range(let _value): + try _value.encode(on: &_container, forKey: .onsetRange) + case .string(let _value): + try _value.encode(on: &_container, forKey: .onsetString, auxiliaryKey: ._onsetString) + } + } + try severity?.encode(on: &_container, forKey: .severity) + try stage?.encode(on: &_container, forKey: .stage) + try subject.encode(on: &_container, forKey: .subject) + try verificationStatus?.encode(on: &_container, forKey: .verificationStatus, auxiliaryKey: ._verificationStatus) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Condition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return abatement == _other.abatement + && assertedDate == _other.assertedDate + && asserter == _other.asserter + && bodySite == _other.bodySite + && category == _other.category + && clinicalStatus == _other.clinicalStatus + && code == _other.code + && context == _other.context + && evidence == _other.evidence + && identifier == _other.identifier + && note == _other.note + && onset == _other.onset + && severity == _other.severity + && stage == _other.stage + && subject == _other.subject + && verificationStatus == _other.verificationStatus + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(abatement) + hasher.combine(assertedDate) + hasher.combine(asserter) + hasher.combine(bodySite) + hasher.combine(category) + hasher.combine(clinicalStatus) + hasher.combine(code) + hasher.combine(context) + hasher.combine(evidence) + hasher.combine(identifier) + hasher.combine(note) + hasher.combine(onset) + hasher.combine(severity) + hasher.combine(stage) + hasher.combine(subject) + hasher.combine(verificationStatus) + } +} + +/** + Supporting evidence. + + Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed. + */ +open class ConditionEvidence: BackboneElement { + + /// Manifestation/symptom + public var code: [CodeableConcept]? + + /// Supporting information found elsewhere + public var detail: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: [CodeableConcept]? = nil, + detail: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.code = code + self.detail = detail + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case detail + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try [CodeableConcept](from: _container, forKeyIfPresent: .code) + self.detail = try [Reference](from: _container, forKeyIfPresent: .detail) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try detail?.encode(on: &_container, forKey: .detail) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConditionEvidence else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && detail == _other.detail + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(detail) + } +} + +/** + Stage/grade, usually assessed formally. + + Clinical stage or grade of a condition. May include formal severity assessments. + */ +open class ConditionStage: BackboneElement { + + /// Simple summary (disease specific) + public var summary: CodeableConcept? + + /// Formal record of assessment + public var assessment: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + assessment: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + summary: CodeableConcept? = nil) + { + self.init() + self.assessment = assessment + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.summary = summary + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case assessment + case summary + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.assessment = try [Reference](from: _container, forKeyIfPresent: .assessment) + self.summary = try CodeableConcept(from: _container, forKeyIfPresent: .summary) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try assessment?.encode(on: &_container, forKey: .assessment) + try summary?.encode(on: &_container, forKey: .summary) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConditionStage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return assessment == _other.assessment + && summary == _other.summary + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(assessment) + hasher.combine(summary) + } +} diff --git a/Sources/ModelsSTU3/Consent.swift b/Sources/ModelsSTU3/Consent.swift new file mode 100644 index 0000000..1b7817a --- /dev/null +++ b/Sources/ModelsSTU3/Consent.swift @@ -0,0 +1,882 @@ +// +// Consent.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Consent) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A healthcare consumer's policy choices to permits or denies recipients or roles to perform actions for specific + purposes and periods of time. + + A record of a healthcare consumer’s policy choices, which permits or denies identified recipient(s) or recipient + role(s) to perform one or more actions within a given policy context, for specific purposes and periods of time. + */ +open class Consent: DomainResource { + + override open class var resourceType: ResourceType { return .consent } + + /// All possible types for "source[x]" + public enum SourceX: Hashable { + case attachment(Attachment) + case identifier(Identifier) + case reference(Reference) + } + + /// Identifier for this record (external references) + public var identifier: Identifier? + + /// Indicates the current state of this consent. + public var status: FHIRPrimitive + + /// Classification of the consent statement - for indexing/retrieval + public var category: [CodeableConcept]? + + /// Who the consent applies to + public var patient: Reference + + /// Period that this consent applies + public var period: Period? + + /// When this Consent was created or indexed + public var dateTime: FHIRPrimitive? + + /// Who is agreeing to the policy and exceptions + public var consentingParty: [Reference]? + + /// Who|what controlled by this consent (or group, by role) + public var actor: [ConsentActor]? + + /// Actions controlled by this consent + public var action: [CodeableConcept]? + + /// Custodian of the consent + public var organization: [Reference]? + + /// Source from which this consent is taken + /// One of `source[x]` + public var source: SourceX? + + /// Policies covered by this consent + public var policy: [ConsentPolicy]? + + /// Policy that this consents to + public var policyRule: FHIRPrimitive? + + /// Security Labels that define affected resources + public var securityLabel: [Coding]? + + /// Context of activities for which the agreement is made + public var purpose: [Coding]? + + /// Timeframe for data controlled by this consent + public var dataPeriod: Period? + + /// Data controlled by this consent + public var data: [ConsentData]? + + /// Additional rule - addition or removal of permissions + public var except: [ConsentExcept]? + + /// Designated initializer taking all required properties + public init(patient: Reference, status: FHIRPrimitive) { + self.patient = patient + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + action: [CodeableConcept]? = nil, + actor: [ConsentActor]? = nil, + category: [CodeableConcept]? = nil, + consentingParty: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + data: [ConsentData]? = nil, + dataPeriod: Period? = nil, + dateTime: FHIRPrimitive? = nil, + except: [ConsentExcept]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + organization: [Reference]? = nil, + patient: Reference, + period: Period? = nil, + policy: [ConsentPolicy]? = nil, + policyRule: FHIRPrimitive? = nil, + purpose: [Coding]? = nil, + securityLabel: [Coding]? = nil, + source: SourceX? = nil, + status: FHIRPrimitive, + text: Narrative? = nil) + { + self.init(patient: patient, status: status) + self.action = action + self.actor = actor + self.category = category + self.consentingParty = consentingParty + self.contained = contained + self.data = data + self.dataPeriod = dataPeriod + self.dateTime = dateTime + self.except = except + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.organization = organization + self.period = period + self.policy = policy + self.policyRule = policyRule + self.purpose = purpose + self.securityLabel = securityLabel + self.source = source + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case actor + case category + case consentingParty + case data + case dataPeriod + case dateTime; case _dateTime + case except + case identifier + case organization + case patient + case period + case policy + case policyRule; case _policyRule + case purpose + case securityLabel + case sourceAttachment + case sourceIdentifier + case sourceReference + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [CodeableConcept](from: _container, forKeyIfPresent: .action) + self.actor = try [ConsentActor](from: _container, forKeyIfPresent: .actor) + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.consentingParty = try [Reference](from: _container, forKeyIfPresent: .consentingParty) + self.data = try [ConsentData](from: _container, forKeyIfPresent: .data) + self.dataPeriod = try Period(from: _container, forKeyIfPresent: .dataPeriod) + self.dateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .dateTime, auxiliaryKey: ._dateTime) + self.except = try [ConsentExcept](from: _container, forKeyIfPresent: .except) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.organization = try [Reference](from: _container, forKeyIfPresent: .organization) + self.patient = try Reference(from: _container, forKey: .patient) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.policy = try [ConsentPolicy](from: _container, forKeyIfPresent: .policy) + self.policyRule = try FHIRPrimitive(from: _container, forKeyIfPresent: .policyRule, auxiliaryKey: ._policyRule) + self.purpose = try [Coding](from: _container, forKeyIfPresent: .purpose) + self.securityLabel = try [Coding](from: _container, forKeyIfPresent: .securityLabel) + var _t_source: SourceX? = nil + if let sourceAttachment = try Attachment(from: _container, forKeyIfPresent: .sourceAttachment) { + if _t_source != nil { + throw DecodingError.dataCorruptedError(forKey: .sourceAttachment, in: _container, debugDescription: "More than one value provided for \"source\"") + } + _t_source = .attachment(sourceAttachment) + } + if let sourceIdentifier = try Identifier(from: _container, forKeyIfPresent: .sourceIdentifier) { + if _t_source != nil { + throw DecodingError.dataCorruptedError(forKey: .sourceIdentifier, in: _container, debugDescription: "More than one value provided for \"source\"") + } + _t_source = .identifier(sourceIdentifier) + } + if let sourceReference = try Reference(from: _container, forKeyIfPresent: .sourceReference) { + if _t_source != nil { + throw DecodingError.dataCorruptedError(forKey: .sourceReference, in: _container, debugDescription: "More than one value provided for \"source\"") + } + _t_source = .reference(sourceReference) + } + self.source = _t_source + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action) + try actor?.encode(on: &_container, forKey: .actor) + try category?.encode(on: &_container, forKey: .category) + try consentingParty?.encode(on: &_container, forKey: .consentingParty) + try data?.encode(on: &_container, forKey: .data) + try dataPeriod?.encode(on: &_container, forKey: .dataPeriod) + try dateTime?.encode(on: &_container, forKey: .dateTime, auxiliaryKey: ._dateTime) + try except?.encode(on: &_container, forKey: .except) + try identifier?.encode(on: &_container, forKey: .identifier) + try organization?.encode(on: &_container, forKey: .organization) + try patient.encode(on: &_container, forKey: .patient) + try period?.encode(on: &_container, forKey: .period) + try policy?.encode(on: &_container, forKey: .policy) + try policyRule?.encode(on: &_container, forKey: .policyRule, auxiliaryKey: ._policyRule) + try purpose?.encode(on: &_container, forKey: .purpose) + try securityLabel?.encode(on: &_container, forKey: .securityLabel) + if let _enum = source { + switch _enum { + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .sourceAttachment) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .sourceIdentifier) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .sourceReference) + } + } + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Consent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && actor == _other.actor + && category == _other.category + && consentingParty == _other.consentingParty + && data == _other.data + && dataPeriod == _other.dataPeriod + && dateTime == _other.dateTime + && except == _other.except + && identifier == _other.identifier + && organization == _other.organization + && patient == _other.patient + && period == _other.period + && policy == _other.policy + && policyRule == _other.policyRule + && purpose == _other.purpose + && securityLabel == _other.securityLabel + && source == _other.source + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(actor) + hasher.combine(category) + hasher.combine(consentingParty) + hasher.combine(data) + hasher.combine(dataPeriod) + hasher.combine(dateTime) + hasher.combine(except) + hasher.combine(identifier) + hasher.combine(organization) + hasher.combine(patient) + hasher.combine(period) + hasher.combine(policy) + hasher.combine(policyRule) + hasher.combine(purpose) + hasher.combine(securityLabel) + hasher.combine(source) + hasher.combine(status) + } +} + +/** + Who|what controlled by this consent (or group, by role). + + Who or what is controlled by this consent. Use group to identify a set of actors by some property they share (e.g. + 'admitting officers'). + */ +open class ConsentActor: BackboneElement { + + /// How the actor is involved + public var role: CodeableConcept + + /// Resource for the actor (or group, by role) + public var reference: Reference + + /// Designated initializer taking all required properties + public init(reference: Reference, role: CodeableConcept) { + self.reference = reference + self.role = role + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reference: Reference, + role: CodeableConcept) + { + self.init(reference: reference, role: role) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case reference + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.reference = try Reference(from: _container, forKey: .reference) + self.role = try CodeableConcept(from: _container, forKey: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try reference.encode(on: &_container, forKey: .reference) + try role.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConsentActor else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return reference == _other.reference + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(reference) + hasher.combine(role) + } +} + +/** + Data controlled by this consent. + + The resources controlled by this consent, if specific resources are referenced. + */ +open class ConsentData: BackboneElement { + + /// How the resource reference is interpreted when testing consent restrictions. + public var meaning: FHIRPrimitive + + /// The actual data reference + public var reference: Reference + + /// Designated initializer taking all required properties + public init(meaning: FHIRPrimitive, reference: Reference) { + self.meaning = meaning + self.reference = reference + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + meaning: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + reference: Reference) + { + self.init(meaning: meaning, reference: reference) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case meaning; case _meaning + case reference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.meaning = try FHIRPrimitive(from: _container, forKey: .meaning, auxiliaryKey: ._meaning) + self.reference = try Reference(from: _container, forKey: .reference) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try meaning.encode(on: &_container, forKey: .meaning, auxiliaryKey: ._meaning) + try reference.encode(on: &_container, forKey: .reference) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConsentData else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return meaning == _other.meaning + && reference == _other.reference + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(meaning) + hasher.combine(reference) + } +} + +/** + Additional rule - addition or removal of permissions. + + An exception to the base policy of this consent. An exception can be an addition or removal of access permissions. + */ +open class ConsentExcept: BackboneElement { + + /// Action to take - permit or deny - when the exception conditions are met. + public var type: FHIRPrimitive + + /// Timeframe for this exception + public var period: Period? + + /// Who|what controlled by this exception (or group, by role) + public var actor: [ConsentExceptActor]? + + /// Actions controlled by this exception + public var action: [CodeableConcept]? + + /// Security Labels that define affected resources + public var securityLabel: [Coding]? + + /// Context of activities covered by this exception + public var purpose: [Coding]? + + /// e.g. Resource Type, Profile, or CDA etc + public var `class`: [Coding]? + + /// e.g. LOINC or SNOMED CT code, etc in the content + public var code: [Coding]? + + /// Timeframe for data controlled by this exception + public var dataPeriod: Period? + + /// Data controlled by this exception + public var data: [ConsentExceptData]? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + action: [CodeableConcept]? = nil, + actor: [ConsentExceptActor]? = nil, + `class`: [Coding]? = nil, + code: [Coding]? = nil, + data: [ConsentExceptData]? = nil, + dataPeriod: Period? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil, + purpose: [Coding]? = nil, + securityLabel: [Coding]? = nil, + type: FHIRPrimitive) + { + self.init(type: type) + self.action = action + self.actor = actor + self.`class` = `class` + self.code = code + self.data = data + self.dataPeriod = dataPeriod + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.period = period + self.purpose = purpose + self.securityLabel = securityLabel + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case actor + case `class` = "class" + case code + case data + case dataPeriod + case period + case purpose + case securityLabel + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [CodeableConcept](from: _container, forKeyIfPresent: .action) + self.actor = try [ConsentExceptActor](from: _container, forKeyIfPresent: .actor) + self.`class` = try [Coding](from: _container, forKeyIfPresent: .`class`) + self.code = try [Coding](from: _container, forKeyIfPresent: .code) + self.data = try [ConsentExceptData](from: _container, forKeyIfPresent: .data) + self.dataPeriod = try Period(from: _container, forKeyIfPresent: .dataPeriod) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.purpose = try [Coding](from: _container, forKeyIfPresent: .purpose) + self.securityLabel = try [Coding](from: _container, forKeyIfPresent: .securityLabel) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action) + try actor?.encode(on: &_container, forKey: .actor) + try `class`?.encode(on: &_container, forKey: .`class`) + try code?.encode(on: &_container, forKey: .code) + try data?.encode(on: &_container, forKey: .data) + try dataPeriod?.encode(on: &_container, forKey: .dataPeriod) + try period?.encode(on: &_container, forKey: .period) + try purpose?.encode(on: &_container, forKey: .purpose) + try securityLabel?.encode(on: &_container, forKey: .securityLabel) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConsentExcept else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && actor == _other.actor + && `class` == _other.`class` + && code == _other.code + && data == _other.data + && dataPeriod == _other.dataPeriod + && period == _other.period + && purpose == _other.purpose + && securityLabel == _other.securityLabel + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(actor) + hasher.combine(`class`) + hasher.combine(code) + hasher.combine(data) + hasher.combine(dataPeriod) + hasher.combine(period) + hasher.combine(purpose) + hasher.combine(securityLabel) + hasher.combine(type) + } +} + +/** + Who|what controlled by this exception (or group, by role). + + Who or what is controlled by this Exception. Use group to identify a set of actors by some property they share (e.g. + 'admitting officers'). + */ +open class ConsentExceptActor: BackboneElement { + + /// How the actor is involved + public var role: CodeableConcept + + /// Resource for the actor (or group, by role) + public var reference: Reference + + /// Designated initializer taking all required properties + public init(reference: Reference, role: CodeableConcept) { + self.reference = reference + self.role = role + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reference: Reference, + role: CodeableConcept) + { + self.init(reference: reference, role: role) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case reference + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.reference = try Reference(from: _container, forKey: .reference) + self.role = try CodeableConcept(from: _container, forKey: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try reference.encode(on: &_container, forKey: .reference) + try role.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConsentExceptActor else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return reference == _other.reference + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(reference) + hasher.combine(role) + } +} + +/** + Data controlled by this exception. + + The resources controlled by this exception, if specific resources are referenced. + */ +open class ConsentExceptData: BackboneElement { + + /// How the resource reference is interpreted when testing consent restrictions. + public var meaning: FHIRPrimitive + + /// The actual data reference + public var reference: Reference + + /// Designated initializer taking all required properties + public init(meaning: FHIRPrimitive, reference: Reference) { + self.meaning = meaning + self.reference = reference + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + meaning: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + reference: Reference) + { + self.init(meaning: meaning, reference: reference) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case meaning; case _meaning + case reference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.meaning = try FHIRPrimitive(from: _container, forKey: .meaning, auxiliaryKey: ._meaning) + self.reference = try Reference(from: _container, forKey: .reference) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try meaning.encode(on: &_container, forKey: .meaning, auxiliaryKey: ._meaning) + try reference.encode(on: &_container, forKey: .reference) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConsentExceptData else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return meaning == _other.meaning + && reference == _other.reference + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(meaning) + hasher.combine(reference) + } +} + +/** + Policies covered by this consent. + + The references to the policies that are included in this consent scope. Policies may be organizational, but are often + defined jurisdictionally, or in law. + */ +open class ConsentPolicy: BackboneElement { + + /// Enforcement source for policy + public var authority: FHIRPrimitive? + + /// Specific policy covered by this consent + public var uri: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + authority: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + uri: FHIRPrimitive? = nil) + { + self.init() + self.authority = authority + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.uri = uri + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authority; case _authority + case uri; case _uri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.authority = try FHIRPrimitive(from: _container, forKeyIfPresent: .authority, auxiliaryKey: ._authority) + self.uri = try FHIRPrimitive(from: _container, forKeyIfPresent: .uri, auxiliaryKey: ._uri) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authority?.encode(on: &_container, forKey: .authority, auxiliaryKey: ._authority) + try uri?.encode(on: &_container, forKey: .uri, auxiliaryKey: ._uri) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ConsentPolicy else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authority == _other.authority + && uri == _other.uri + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authority) + hasher.combine(uri) + } +} diff --git a/Sources/ModelsSTU3/ContactDetail.swift b/Sources/ModelsSTU3/ContactDetail.swift new file mode 100644 index 0000000..4ed50e5 --- /dev/null +++ b/Sources/ModelsSTU3/ContactDetail.swift @@ -0,0 +1,99 @@ +// +// ContactDetail.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ContactDetail) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Contact information. + + Specifies contact information for a person or organization. + */ +open class ContactDetail: Element { + + /// Name of an individual to contact + public var name: FHIRPrimitive? + + /// Contact details for individual or organization + public var telecom: [ContactPoint]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + name: FHIRPrimitive? = nil, + telecom: [ContactPoint]? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.name = name + self.telecom = telecom + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case name; case _name + case telecom + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try telecom?.encode(on: &_container, forKey: .telecom) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContactDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return name == _other.name + && telecom == _other.telecom + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(name) + hasher.combine(telecom) + } +} diff --git a/Sources/ModelsSTU3/ContactPoint.swift b/Sources/ModelsSTU3/ContactPoint.swift new file mode 100644 index 0000000..31f4337 --- /dev/null +++ b/Sources/ModelsSTU3/ContactPoint.swift @@ -0,0 +1,130 @@ +// +// ContactPoint.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ContactPoint) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Details of a Technology mediated contact point (phone, fax, email, etc.). + + Details for all kinds of technology mediated contact points for a person or organization, including telephone, email, + etc. + */ +open class ContactPoint: Element { + + /// Telecommunications form for contact point - what communications system is required to make use of the contact. + public var system: FHIRPrimitive? + + /// The actual contact point details + public var value: FHIRPrimitive? + + /// Identifies the purpose for the contact point. + public var use: FHIRPrimitive? + + /// Specify preferred order of use (1 = highest) + public var rank: FHIRPrimitive? + + /// Time period when the contact point was/is in use + public var period: Period? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + period: Period? = nil, + rank: FHIRPrimitive? = nil, + system: FHIRPrimitive? = nil, + use: FHIRPrimitive? = nil, + value: FHIRPrimitive? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.period = period + self.rank = rank + self.system = system + self.use = use + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case period + case rank; case _rank + case system; case _system + case use; case _use + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.rank = try FHIRPrimitive(from: _container, forKeyIfPresent: .rank, auxiliaryKey: ._rank) + self.system = try FHIRPrimitive(from: _container, forKeyIfPresent: .system, auxiliaryKey: ._system) + self.use = try FHIRPrimitive(from: _container, forKeyIfPresent: .use, auxiliaryKey: ._use) + self.value = try FHIRPrimitive(from: _container, forKeyIfPresent: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try period?.encode(on: &_container, forKey: .period) + try rank?.encode(on: &_container, forKey: .rank, auxiliaryKey: ._rank) + try system?.encode(on: &_container, forKey: .system, auxiliaryKey: ._system) + try use?.encode(on: &_container, forKey: .use, auxiliaryKey: ._use) + try value?.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContactPoint else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return period == _other.period + && rank == _other.rank + && system == _other.system + && use == _other.use + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(period) + hasher.combine(rank) + hasher.combine(system) + hasher.combine(use) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/Contract.swift b/Sources/ModelsSTU3/Contract.swift new file mode 100644 index 0000000..382a5d1 --- /dev/null +++ b/Sources/ModelsSTU3/Contract.swift @@ -0,0 +1,1451 @@ +// +// Contract.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Contract) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Legal Agreement. + + A formal agreement between parties regarding the conduct of business, exchange of information or other matters. + */ +open class Contract: DomainResource { + + override open class var resourceType: ResourceType { return .contract } + + /// All possible types for "binding[x]" + public enum BindingX: Hashable { + case attachment(Attachment) + case reference(Reference) + } + + /// Contract number + public var identifier: Identifier? + + /// amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | + /// policy | rejected | renewed | revoked | resolved | terminated + public var status: FHIRPrimitive? + + /// When this Contract was issued + public var issued: FHIRPrimitive? + + /// Effective time + public var applies: Period? + + /// Contract Target Entity + public var subject: [Reference]? + + /// Context of the Contract + public var topic: [Reference]? + + /// Authority under which this Contract has standing + public var authority: [Reference]? + + /// Domain in which this Contract applies + public var domain: [Reference]? + + /// Type or form + public var type: CodeableConcept? + + /// Subtype within the context of type + public var subType: [CodeableConcept]? + + /// Action stipulated by this Contract + public var action: [CodeableConcept]? + + /// Rationale for the stiplulated action + public var actionReason: [CodeableConcept]? + + /// Decision by Grantor + public var decisionType: CodeableConcept? + + /// Content derived from the basal information + public var contentDerivative: CodeableConcept? + + /// Security Labels that define affected resources + public var securityLabel: [Coding]? + + /// Entity being ascribed responsibility + public var agent: [ContractAgent]? + + /// Contract Signatory + public var signer: [ContractSigner]? + + /// Contract Valued Item List + public var valuedItem: [ContractValuedItem]? + + /// Contract Term List + public var term: [ContractTerm]? + + /// Binding Contract + /// One of `binding[x]` + public var binding: BindingX? + + /// Contract Friendly Language + public var friendly: [ContractFriendly]? + + /// Contract Legal Language + public var legal: [ContractLegal]? + + /// Computable Contract Language + public var rule: [ContractRule]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + action: [CodeableConcept]? = nil, + actionReason: [CodeableConcept]? = nil, + agent: [ContractAgent]? = nil, + applies: Period? = nil, + authority: [Reference]? = nil, + binding: BindingX? = nil, + contained: [ResourceProxy]? = nil, + contentDerivative: CodeableConcept? = nil, + decisionType: CodeableConcept? = nil, + domain: [Reference]? = nil, + `extension`: [Extension]? = nil, + friendly: [ContractFriendly]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + issued: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + legal: [ContractLegal]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + rule: [ContractRule]? = nil, + securityLabel: [Coding]? = nil, + signer: [ContractSigner]? = nil, + status: FHIRPrimitive? = nil, + subType: [CodeableConcept]? = nil, + subject: [Reference]? = nil, + term: [ContractTerm]? = nil, + text: Narrative? = nil, + topic: [Reference]? = nil, + type: CodeableConcept? = nil, + valuedItem: [ContractValuedItem]? = nil) + { + self.init() + self.action = action + self.actionReason = actionReason + self.agent = agent + self.applies = applies + self.authority = authority + self.binding = binding + self.contained = contained + self.contentDerivative = contentDerivative + self.decisionType = decisionType + self.domain = domain + self.`extension` = `extension` + self.friendly = friendly + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.issued = issued + self.language = language + self.legal = legal + self.meta = meta + self.modifierExtension = modifierExtension + self.rule = rule + self.securityLabel = securityLabel + self.signer = signer + self.status = status + self.subType = subType + self.subject = subject + self.term = term + self.text = text + self.topic = topic + self.type = type + self.valuedItem = valuedItem + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case actionReason + case agent + case applies + case authority + case bindingAttachment + case bindingReference + case contentDerivative + case decisionType + case domain + case friendly + case identifier + case issued; case _issued + case legal + case rule + case securityLabel + case signer + case status; case _status + case subType + case subject + case term + case topic + case type + case valuedItem + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [CodeableConcept](from: _container, forKeyIfPresent: .action) + self.actionReason = try [CodeableConcept](from: _container, forKeyIfPresent: .actionReason) + self.agent = try [ContractAgent](from: _container, forKeyIfPresent: .agent) + self.applies = try Period(from: _container, forKeyIfPresent: .applies) + self.authority = try [Reference](from: _container, forKeyIfPresent: .authority) + var _t_binding: BindingX? = nil + if let bindingAttachment = try Attachment(from: _container, forKeyIfPresent: .bindingAttachment) { + if _t_binding != nil { + throw DecodingError.dataCorruptedError(forKey: .bindingAttachment, in: _container, debugDescription: "More than one value provided for \"binding\"") + } + _t_binding = .attachment(bindingAttachment) + } + if let bindingReference = try Reference(from: _container, forKeyIfPresent: .bindingReference) { + if _t_binding != nil { + throw DecodingError.dataCorruptedError(forKey: .bindingReference, in: _container, debugDescription: "More than one value provided for \"binding\"") + } + _t_binding = .reference(bindingReference) + } + self.binding = _t_binding + self.contentDerivative = try CodeableConcept(from: _container, forKeyIfPresent: .contentDerivative) + self.decisionType = try CodeableConcept(from: _container, forKeyIfPresent: .decisionType) + self.domain = try [Reference](from: _container, forKeyIfPresent: .domain) + self.friendly = try [ContractFriendly](from: _container, forKeyIfPresent: .friendly) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.issued = try FHIRPrimitive(from: _container, forKeyIfPresent: .issued, auxiliaryKey: ._issued) + self.legal = try [ContractLegal](from: _container, forKeyIfPresent: .legal) + self.rule = try [ContractRule](from: _container, forKeyIfPresent: .rule) + self.securityLabel = try [Coding](from: _container, forKeyIfPresent: .securityLabel) + self.signer = try [ContractSigner](from: _container, forKeyIfPresent: .signer) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subType = try [CodeableConcept](from: _container, forKeyIfPresent: .subType) + self.subject = try [Reference](from: _container, forKeyIfPresent: .subject) + self.term = try [ContractTerm](from: _container, forKeyIfPresent: .term) + self.topic = try [Reference](from: _container, forKeyIfPresent: .topic) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + self.valuedItem = try [ContractValuedItem](from: _container, forKeyIfPresent: .valuedItem) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action) + try actionReason?.encode(on: &_container, forKey: .actionReason) + try agent?.encode(on: &_container, forKey: .agent) + try applies?.encode(on: &_container, forKey: .applies) + try authority?.encode(on: &_container, forKey: .authority) + if let _enum = binding { + switch _enum { + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .bindingAttachment) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .bindingReference) + } + } + try contentDerivative?.encode(on: &_container, forKey: .contentDerivative) + try decisionType?.encode(on: &_container, forKey: .decisionType) + try domain?.encode(on: &_container, forKey: .domain) + try friendly?.encode(on: &_container, forKey: .friendly) + try identifier?.encode(on: &_container, forKey: .identifier) + try issued?.encode(on: &_container, forKey: .issued, auxiliaryKey: ._issued) + try legal?.encode(on: &_container, forKey: .legal) + try rule?.encode(on: &_container, forKey: .rule) + try securityLabel?.encode(on: &_container, forKey: .securityLabel) + try signer?.encode(on: &_container, forKey: .signer) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subType?.encode(on: &_container, forKey: .subType) + try subject?.encode(on: &_container, forKey: .subject) + try term?.encode(on: &_container, forKey: .term) + try topic?.encode(on: &_container, forKey: .topic) + try type?.encode(on: &_container, forKey: .type) + try valuedItem?.encode(on: &_container, forKey: .valuedItem) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Contract else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && actionReason == _other.actionReason + && agent == _other.agent + && applies == _other.applies + && authority == _other.authority + && binding == _other.binding + && contentDerivative == _other.contentDerivative + && decisionType == _other.decisionType + && domain == _other.domain + && friendly == _other.friendly + && identifier == _other.identifier + && issued == _other.issued + && legal == _other.legal + && rule == _other.rule + && securityLabel == _other.securityLabel + && signer == _other.signer + && status == _other.status + && subType == _other.subType + && subject == _other.subject + && term == _other.term + && topic == _other.topic + && type == _other.type + && valuedItem == _other.valuedItem + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(actionReason) + hasher.combine(agent) + hasher.combine(applies) + hasher.combine(authority) + hasher.combine(binding) + hasher.combine(contentDerivative) + hasher.combine(decisionType) + hasher.combine(domain) + hasher.combine(friendly) + hasher.combine(identifier) + hasher.combine(issued) + hasher.combine(legal) + hasher.combine(rule) + hasher.combine(securityLabel) + hasher.combine(signer) + hasher.combine(status) + hasher.combine(subType) + hasher.combine(subject) + hasher.combine(term) + hasher.combine(topic) + hasher.combine(type) + hasher.combine(valuedItem) + } +} + +/** + Entity being ascribed responsibility. + + An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity + taking place. + */ +open class ContractAgent: BackboneElement { + + /// Contract Agent Type + public var actor: Reference + + /// Role type of the agent + public var role: [CodeableConcept]? + + /// Designated initializer taking all required properties + public init(actor: Reference) { + self.actor = actor + super.init() + } + + /// Convenience initializer + public convenience init( + actor: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + role: [CodeableConcept]? = nil) + { + self.init(actor: actor) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actor + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actor = try Reference(from: _container, forKey: .actor) + self.role = try [CodeableConcept](from: _container, forKeyIfPresent: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actor.encode(on: &_container, forKey: .actor) + try role?.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContractAgent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actor == _other.actor + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actor) + hasher.combine(role) + } +} + +/** + Contract Friendly Language. + + The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the + representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a + layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the + Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement. + */ +open class ContractFriendly: BackboneElement { + + /// All possible types for "content[x]" + public enum ContentX: Hashable { + case attachment(Attachment) + case reference(Reference) + } + + /// Easily comprehended representation of this Contract + /// One of `content[x]` + public var content: ContentX + + /// Designated initializer taking all required properties + public init(content: ContentX) { + self.content = content + super.init() + } + + /// Convenience initializer + public convenience init( + content: ContentX, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(content: content) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contentAttachment + case contentReference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.contentAttachment) || _container.contains(CodingKeys.contentReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.contentAttachment, CodingKeys.contentReference], debugDescription: "Must have at least one value for \"content\" but have none")) + } + + // Decode all our properties + var _t_content: ContentX? = nil + if let contentAttachment = try Attachment(from: _container, forKeyIfPresent: .contentAttachment) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentAttachment, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .attachment(contentAttachment) + } + if let contentReference = try Reference(from: _container, forKeyIfPresent: .contentReference) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentReference, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .reference(contentReference) + } + self.content = _t_content! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + + switch content { + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .contentAttachment) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .contentReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContractFriendly else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return content == _other.content + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(content) + } +} + +/** + Contract Legal Language. + + List of Legal expressions or representations of this Contract. + */ +open class ContractLegal: BackboneElement { + + /// All possible types for "content[x]" + public enum ContentX: Hashable { + case attachment(Attachment) + case reference(Reference) + } + + /// Contract Legal Text + /// One of `content[x]` + public var content: ContentX + + /// Designated initializer taking all required properties + public init(content: ContentX) { + self.content = content + super.init() + } + + /// Convenience initializer + public convenience init( + content: ContentX, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(content: content) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contentAttachment + case contentReference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.contentAttachment) || _container.contains(CodingKeys.contentReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.contentAttachment, CodingKeys.contentReference], debugDescription: "Must have at least one value for \"content\" but have none")) + } + + // Decode all our properties + var _t_content: ContentX? = nil + if let contentAttachment = try Attachment(from: _container, forKeyIfPresent: .contentAttachment) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentAttachment, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .attachment(contentAttachment) + } + if let contentReference = try Reference(from: _container, forKeyIfPresent: .contentReference) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentReference, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .reference(contentReference) + } + self.content = _t_content! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + + switch content { + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .contentAttachment) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .contentReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContractLegal else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return content == _other.content + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(content) + } +} + +/** + Computable Contract Language. + + List of Computable Policy Rule Language Representations of this Contract. + */ +open class ContractRule: BackboneElement { + + /// All possible types for "content[x]" + public enum ContentX: Hashable { + case attachment(Attachment) + case reference(Reference) + } + + /// Computable Contract Rules + /// One of `content[x]` + public var content: ContentX + + /// Designated initializer taking all required properties + public init(content: ContentX) { + self.content = content + super.init() + } + + /// Convenience initializer + public convenience init( + content: ContentX, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(content: content) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contentAttachment + case contentReference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.contentAttachment) || _container.contains(CodingKeys.contentReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.contentAttachment, CodingKeys.contentReference], debugDescription: "Must have at least one value for \"content\" but have none")) + } + + // Decode all our properties + var _t_content: ContentX? = nil + if let contentAttachment = try Attachment(from: _container, forKeyIfPresent: .contentAttachment) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentAttachment, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .attachment(contentAttachment) + } + if let contentReference = try Reference(from: _container, forKeyIfPresent: .contentReference) { + if _t_content != nil { + throw DecodingError.dataCorruptedError(forKey: .contentReference, in: _container, debugDescription: "More than one value provided for \"content\"") + } + _t_content = .reference(contentReference) + } + self.content = _t_content! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + + switch content { + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .contentAttachment) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .contentReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContractRule else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return content == _other.content + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(content) + } +} + +/** + Contract Signatory. + + Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are + any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the + contract such as a notary or witness. + */ +open class ContractSigner: BackboneElement { + + /// Contract Signatory Role + public var type: Coding + + /// Contract Signatory Party + public var party: Reference + + /// Contract Documentation Signature + public var signature: [Signature] + + /// Designated initializer taking all required properties + public init(party: Reference, signature: [Signature], type: Coding) { + self.party = party + self.signature = signature + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + party: Reference, + signature: [Signature], + type: Coding) + { + self.init(party: party, signature: signature, type: type) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case party + case signature + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.party = try Reference(from: _container, forKey: .party) + self.signature = try [Signature](from: _container, forKey: .signature) + self.type = try Coding(from: _container, forKey: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try party.encode(on: &_container, forKey: .party) + try signature.encode(on: &_container, forKey: .signature) + try type.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContractSigner else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return party == _other.party + && signature == _other.signature + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(party) + hasher.combine(signature) + hasher.combine(type) + } +} + +/** + Contract Term List. + + One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups. + */ +open class ContractTerm: BackboneElement { + + /// Contract Term Number + public var identifier: Identifier? + + /// Contract Term Issue Date Time + public var issued: FHIRPrimitive? + + /// Contract Term Effective Time + public var applies: Period? + + /// Contract Term Type or Form + public var type: CodeableConcept? + + /// Contract Term Type specific classification + public var subType: CodeableConcept? + + /// Context of the Contract term + public var topic: [Reference]? + + /// Contract Term Activity + public var action: [CodeableConcept]? + + /// Purpose for the Contract Term Action + public var actionReason: [CodeableConcept]? + + /// Security Labels that define affected terms + public var securityLabel: [Coding]? + + /// Contract Term Agent List + public var agent: [ContractTermAgent]? + + /// Human readable Contract term text + public var text: FHIRPrimitive? + + /// Contract Term Valued Item List + public var valuedItem: [ContractTermValuedItem]? + + /// Nested Contract Term Group + public var group: [ContractTerm]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + action: [CodeableConcept]? = nil, + actionReason: [CodeableConcept]? = nil, + agent: [ContractTermAgent]? = nil, + applies: Period? = nil, + `extension`: [Extension]? = nil, + group: [ContractTerm]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + issued: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + securityLabel: [Coding]? = nil, + subType: CodeableConcept? = nil, + text: FHIRPrimitive? = nil, + topic: [Reference]? = nil, + type: CodeableConcept? = nil, + valuedItem: [ContractTermValuedItem]? = nil) + { + self.init() + self.action = action + self.actionReason = actionReason + self.agent = agent + self.applies = applies + self.`extension` = `extension` + self.group = group + self.id = id + self.identifier = identifier + self.issued = issued + self.modifierExtension = modifierExtension + self.securityLabel = securityLabel + self.subType = subType + self.text = text + self.topic = topic + self.type = type + self.valuedItem = valuedItem + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case actionReason + case agent + case applies + case group + case identifier + case issued; case _issued + case securityLabel + case subType + case text; case _text + case topic + case type + case valuedItem + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [CodeableConcept](from: _container, forKeyIfPresent: .action) + self.actionReason = try [CodeableConcept](from: _container, forKeyIfPresent: .actionReason) + self.agent = try [ContractTermAgent](from: _container, forKeyIfPresent: .agent) + self.applies = try Period(from: _container, forKeyIfPresent: .applies) + self.group = try [ContractTerm](from: _container, forKeyIfPresent: .group) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.issued = try FHIRPrimitive(from: _container, forKeyIfPresent: .issued, auxiliaryKey: ._issued) + self.securityLabel = try [Coding](from: _container, forKeyIfPresent: .securityLabel) + self.subType = try CodeableConcept(from: _container, forKeyIfPresent: .subType) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + self.topic = try [Reference](from: _container, forKeyIfPresent: .topic) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + self.valuedItem = try [ContractTermValuedItem](from: _container, forKeyIfPresent: .valuedItem) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action) + try actionReason?.encode(on: &_container, forKey: .actionReason) + try agent?.encode(on: &_container, forKey: .agent) + try applies?.encode(on: &_container, forKey: .applies) + try group?.encode(on: &_container, forKey: .group) + try identifier?.encode(on: &_container, forKey: .identifier) + try issued?.encode(on: &_container, forKey: .issued, auxiliaryKey: ._issued) + try securityLabel?.encode(on: &_container, forKey: .securityLabel) + try subType?.encode(on: &_container, forKey: .subType) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try topic?.encode(on: &_container, forKey: .topic) + try type?.encode(on: &_container, forKey: .type) + try valuedItem?.encode(on: &_container, forKey: .valuedItem) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContractTerm else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && actionReason == _other.actionReason + && agent == _other.agent + && applies == _other.applies + && group == _other.group + && identifier == _other.identifier + && issued == _other.issued + && securityLabel == _other.securityLabel + && subType == _other.subType + && text == _other.text + && topic == _other.topic + && type == _other.type + && valuedItem == _other.valuedItem + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(actionReason) + hasher.combine(agent) + hasher.combine(applies) + hasher.combine(group) + hasher.combine(identifier) + hasher.combine(issued) + hasher.combine(securityLabel) + hasher.combine(subType) + hasher.combine(text) + hasher.combine(topic) + hasher.combine(type) + hasher.combine(valuedItem) + } +} + +/** + Contract Term Agent List. + + An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity + taking place. + */ +open class ContractTermAgent: BackboneElement { + + /// Contract Term Agent Subject + public var actor: Reference + + /// Type of the Contract Term Agent + public var role: [CodeableConcept]? + + /// Designated initializer taking all required properties + public init(actor: Reference) { + self.actor = actor + super.init() + } + + /// Convenience initializer + public convenience init( + actor: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + role: [CodeableConcept]? = nil) + { + self.init(actor: actor) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actor + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actor = try Reference(from: _container, forKey: .actor) + self.role = try [CodeableConcept](from: _container, forKeyIfPresent: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actor.encode(on: &_container, forKey: .actor) + try role?.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContractTermAgent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actor == _other.actor + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actor) + hasher.combine(role) + } +} + +/** + Contract Term Valued Item List. + + Contract Provision Valued Item List. + */ +open class ContractTermValuedItem: BackboneElement { + + /// All possible types for "entity[x]" + public enum EntityX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Contract Term Valued Item Type + /// One of `entity[x]` + public var entity: EntityX? + + /// Contract Term Valued Item Number + public var identifier: Identifier? + + /// Contract Term Valued Item Effective Tiem + public var effectiveTime: FHIRPrimitive? + + /// Contract Term Valued Item Count + public var quantity: Quantity? + + /// Contract Term Valued Item fee, charge, or cost + public var unitPrice: Money? + + /// Contract Term Valued Item Price Scaling Factor + public var factor: FHIRPrimitive? + + /// Contract Term Valued Item Difficulty Scaling Factor + public var points: FHIRPrimitive? + + /// Total Contract Term Valued Item Value + public var net: Money? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + effectiveTime: FHIRPrimitive? = nil, + entity: EntityX? = nil, + `extension`: [Extension]? = nil, + factor: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + net: Money? = nil, + points: FHIRPrimitive? = nil, + quantity: Quantity? = nil, + unitPrice: Money? = nil) + { + self.init() + self.effectiveTime = effectiveTime + self.entity = entity + self.`extension` = `extension` + self.factor = factor + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.net = net + self.points = points + self.quantity = quantity + self.unitPrice = unitPrice + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case effectiveTime; case _effectiveTime + case entityCodeableConcept + case entityReference + case factor; case _factor + case identifier + case net + case points; case _points + case quantity + case unitPrice + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.effectiveTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .effectiveTime, auxiliaryKey: ._effectiveTime) + var _t_entity: EntityX? = nil + if let entityCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .entityCodeableConcept) { + if _t_entity != nil { + throw DecodingError.dataCorruptedError(forKey: .entityCodeableConcept, in: _container, debugDescription: "More than one value provided for \"entity\"") + } + _t_entity = .codeableConcept(entityCodeableConcept) + } + if let entityReference = try Reference(from: _container, forKeyIfPresent: .entityReference) { + if _t_entity != nil { + throw DecodingError.dataCorruptedError(forKey: .entityReference, in: _container, debugDescription: "More than one value provided for \"entity\"") + } + _t_entity = .reference(entityReference) + } + self.entity = _t_entity + self.factor = try FHIRPrimitive(from: _container, forKeyIfPresent: .factor, auxiliaryKey: ._factor) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.net = try Money(from: _container, forKeyIfPresent: .net) + self.points = try FHIRPrimitive(from: _container, forKeyIfPresent: .points, auxiliaryKey: ._points) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.unitPrice = try Money(from: _container, forKeyIfPresent: .unitPrice) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try effectiveTime?.encode(on: &_container, forKey: .effectiveTime, auxiliaryKey: ._effectiveTime) + if let _enum = entity { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .entityCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .entityReference) + } + } + try factor?.encode(on: &_container, forKey: .factor, auxiliaryKey: ._factor) + try identifier?.encode(on: &_container, forKey: .identifier) + try net?.encode(on: &_container, forKey: .net) + try points?.encode(on: &_container, forKey: .points, auxiliaryKey: ._points) + try quantity?.encode(on: &_container, forKey: .quantity) + try unitPrice?.encode(on: &_container, forKey: .unitPrice) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContractTermValuedItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return effectiveTime == _other.effectiveTime + && entity == _other.entity + && factor == _other.factor + && identifier == _other.identifier + && net == _other.net + && points == _other.points + && quantity == _other.quantity + && unitPrice == _other.unitPrice + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(effectiveTime) + hasher.combine(entity) + hasher.combine(factor) + hasher.combine(identifier) + hasher.combine(net) + hasher.combine(points) + hasher.combine(quantity) + hasher.combine(unitPrice) + } +} + +/** + Contract Valued Item List. + */ +open class ContractValuedItem: BackboneElement { + + /// All possible types for "entity[x]" + public enum EntityX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Contract Valued Item Type + /// One of `entity[x]` + public var entity: EntityX? + + /// Contract Valued Item Number + public var identifier: Identifier? + + /// Contract Valued Item Effective Tiem + public var effectiveTime: FHIRPrimitive? + + /// Count of Contract Valued Items + public var quantity: Quantity? + + /// Contract Valued Item fee, charge, or cost + public var unitPrice: Money? + + /// Contract Valued Item Price Scaling Factor + public var factor: FHIRPrimitive? + + /// Contract Valued Item Difficulty Scaling Factor + public var points: FHIRPrimitive? + + /// Total Contract Valued Item Value + public var net: Money? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + effectiveTime: FHIRPrimitive? = nil, + entity: EntityX? = nil, + `extension`: [Extension]? = nil, + factor: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + net: Money? = nil, + points: FHIRPrimitive? = nil, + quantity: Quantity? = nil, + unitPrice: Money? = nil) + { + self.init() + self.effectiveTime = effectiveTime + self.entity = entity + self.`extension` = `extension` + self.factor = factor + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.net = net + self.points = points + self.quantity = quantity + self.unitPrice = unitPrice + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case effectiveTime; case _effectiveTime + case entityCodeableConcept + case entityReference + case factor; case _factor + case identifier + case net + case points; case _points + case quantity + case unitPrice + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.effectiveTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .effectiveTime, auxiliaryKey: ._effectiveTime) + var _t_entity: EntityX? = nil + if let entityCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .entityCodeableConcept) { + if _t_entity != nil { + throw DecodingError.dataCorruptedError(forKey: .entityCodeableConcept, in: _container, debugDescription: "More than one value provided for \"entity\"") + } + _t_entity = .codeableConcept(entityCodeableConcept) + } + if let entityReference = try Reference(from: _container, forKeyIfPresent: .entityReference) { + if _t_entity != nil { + throw DecodingError.dataCorruptedError(forKey: .entityReference, in: _container, debugDescription: "More than one value provided for \"entity\"") + } + _t_entity = .reference(entityReference) + } + self.entity = _t_entity + self.factor = try FHIRPrimitive(from: _container, forKeyIfPresent: .factor, auxiliaryKey: ._factor) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.net = try Money(from: _container, forKeyIfPresent: .net) + self.points = try FHIRPrimitive(from: _container, forKeyIfPresent: .points, auxiliaryKey: ._points) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.unitPrice = try Money(from: _container, forKeyIfPresent: .unitPrice) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try effectiveTime?.encode(on: &_container, forKey: .effectiveTime, auxiliaryKey: ._effectiveTime) + if let _enum = entity { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .entityCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .entityReference) + } + } + try factor?.encode(on: &_container, forKey: .factor, auxiliaryKey: ._factor) + try identifier?.encode(on: &_container, forKey: .identifier) + try net?.encode(on: &_container, forKey: .net) + try points?.encode(on: &_container, forKey: .points, auxiliaryKey: ._points) + try quantity?.encode(on: &_container, forKey: .quantity) + try unitPrice?.encode(on: &_container, forKey: .unitPrice) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ContractValuedItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return effectiveTime == _other.effectiveTime + && entity == _other.entity + && factor == _other.factor + && identifier == _other.identifier + && net == _other.net + && points == _other.points + && quantity == _other.quantity + && unitPrice == _other.unitPrice + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(effectiveTime) + hasher.combine(entity) + hasher.combine(factor) + hasher.combine(identifier) + hasher.combine(net) + hasher.combine(points) + hasher.combine(quantity) + hasher.combine(unitPrice) + } +} diff --git a/Sources/ModelsSTU3/Contributor.swift b/Sources/ModelsSTU3/Contributor.swift new file mode 100644 index 0000000..9c27bc0 --- /dev/null +++ b/Sources/ModelsSTU3/Contributor.swift @@ -0,0 +1,109 @@ +// +// Contributor.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Contributor) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Contributor information. + + A contributor to the content of a knowledge asset, including authors, editors, reviewers, and endorsers. + */ +open class Contributor: Element { + + /// The type of contributor. + public var type: FHIRPrimitive + + /// Who contributed the content + public var name: FHIRPrimitive + + /// Contact details of the contributor + public var contact: [ContactDetail]? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive, type: FHIRPrimitive) { + self.name = name + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + contact: [ContactDetail]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + name: FHIRPrimitive, + type: FHIRPrimitive) + { + self.init(name: name, type: type) + self.contact = contact + self.`extension` = `extension` + self.id = id + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contact + case name; case _name + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contact?.encode(on: &_container, forKey: .contact) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Contributor else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contact == _other.contact + && name == _other.name + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contact) + hasher.combine(name) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/Count.swift b/Sources/ModelsSTU3/Count.swift new file mode 100644 index 0000000..4b45221 --- /dev/null +++ b/Sources/ModelsSTU3/Count.swift @@ -0,0 +1,82 @@ +// +// Count.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Count) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A measured or measurable amount. + + A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are + not precisely quantified, including amounts involving arbitrary units and floating currencies. + */ +open class Count: Quantity { + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive? = nil, + comparator: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + system: FHIRPrimitive? = nil, + unit: FHIRPrimitive? = nil, + value: FHIRPrimitive? = nil) + { + self.init() + self.code = code + self.comparator = comparator + self.`extension` = `extension` + self.id = id + self.system = system + self.unit = unit + self.value = value + } + + // MARK: - Codable + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Count else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return true + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + } +} diff --git a/Sources/ModelsSTU3/Coverage.swift b/Sources/ModelsSTU3/Coverage.swift new file mode 100644 index 0000000..9edc41b --- /dev/null +++ b/Sources/ModelsSTU3/Coverage.swift @@ -0,0 +1,435 @@ +// +// Coverage.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Coverage) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Insurance or medical plan or a payment agreement. + + Financial instrument which may be used to reimburse or pay for health care products and services. + */ +open class Coverage: DomainResource { + + override open class var resourceType: ResourceType { return .coverage } + + /// The primary coverage ID + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// Type of coverage such as medical or accident + public var type: CodeableConcept? + + /// Owner of the policy + public var policyHolder: Reference? + + /// Subscriber to the policy + public var subscriber: Reference? + + /// ID assigned to the Subscriber + public var subscriberId: FHIRPrimitive? + + /// Plan Beneficiary + public var beneficiary: Reference? + + /// Beneficiary relationship to the Subscriber + public var relationship: CodeableConcept? + + /// Coverage start and end dates + public var period: Period? + + /// Identifier for the plan or agreement issuer + public var payor: [Reference]? + + /// Additional coverage classifications + public var grouping: CoverageGrouping? + + /// Dependent number + public var dependent: FHIRPrimitive? + + /// The plan instance or sequence counter + public var sequence: FHIRPrimitive? + + /// Relative order of the coverage + public var order: FHIRPrimitive? + + /// Insurer network + public var network: FHIRPrimitive? + + /// Contract details + public var contract: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + beneficiary: Reference? = nil, + contained: [ResourceProxy]? = nil, + contract: [Reference]? = nil, + dependent: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + grouping: CoverageGrouping? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + network: FHIRPrimitive? = nil, + order: FHIRPrimitive? = nil, + payor: [Reference]? = nil, + period: Period? = nil, + policyHolder: Reference? = nil, + relationship: CodeableConcept? = nil, + sequence: FHIRPrimitive? = nil, + status: FHIRPrimitive? = nil, + subscriber: Reference? = nil, + subscriberId: FHIRPrimitive? = nil, + text: Narrative? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.beneficiary = beneficiary + self.contained = contained + self.contract = contract + self.dependent = dependent + self.`extension` = `extension` + self.grouping = grouping + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.network = network + self.order = order + self.payor = payor + self.period = period + self.policyHolder = policyHolder + self.relationship = relationship + self.sequence = sequence + self.status = status + self.subscriber = subscriber + self.subscriberId = subscriberId + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case beneficiary + case contract + case dependent; case _dependent + case grouping + case identifier + case network; case _network + case order; case _order + case payor + case period + case policyHolder + case relationship + case sequence; case _sequence + case status; case _status + case subscriber + case subscriberId; case _subscriberId + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.beneficiary = try Reference(from: _container, forKeyIfPresent: .beneficiary) + self.contract = try [Reference](from: _container, forKeyIfPresent: .contract) + self.dependent = try FHIRPrimitive(from: _container, forKeyIfPresent: .dependent, auxiliaryKey: ._dependent) + self.grouping = try CoverageGrouping(from: _container, forKeyIfPresent: .grouping) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.network = try FHIRPrimitive(from: _container, forKeyIfPresent: .network, auxiliaryKey: ._network) + self.order = try FHIRPrimitive(from: _container, forKeyIfPresent: .order, auxiliaryKey: ._order) + self.payor = try [Reference](from: _container, forKeyIfPresent: .payor) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.policyHolder = try Reference(from: _container, forKeyIfPresent: .policyHolder) + self.relationship = try CodeableConcept(from: _container, forKeyIfPresent: .relationship) + self.sequence = try FHIRPrimitive(from: _container, forKeyIfPresent: .sequence, auxiliaryKey: ._sequence) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subscriber = try Reference(from: _container, forKeyIfPresent: .subscriber) + self.subscriberId = try FHIRPrimitive(from: _container, forKeyIfPresent: .subscriberId, auxiliaryKey: ._subscriberId) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try beneficiary?.encode(on: &_container, forKey: .beneficiary) + try contract?.encode(on: &_container, forKey: .contract) + try dependent?.encode(on: &_container, forKey: .dependent, auxiliaryKey: ._dependent) + try grouping?.encode(on: &_container, forKey: .grouping) + try identifier?.encode(on: &_container, forKey: .identifier) + try network?.encode(on: &_container, forKey: .network, auxiliaryKey: ._network) + try order?.encode(on: &_container, forKey: .order, auxiliaryKey: ._order) + try payor?.encode(on: &_container, forKey: .payor) + try period?.encode(on: &_container, forKey: .period) + try policyHolder?.encode(on: &_container, forKey: .policyHolder) + try relationship?.encode(on: &_container, forKey: .relationship) + try sequence?.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subscriber?.encode(on: &_container, forKey: .subscriber) + try subscriberId?.encode(on: &_container, forKey: .subscriberId, auxiliaryKey: ._subscriberId) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Coverage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return beneficiary == _other.beneficiary + && contract == _other.contract + && dependent == _other.dependent + && grouping == _other.grouping + && identifier == _other.identifier + && network == _other.network + && order == _other.order + && payor == _other.payor + && period == _other.period + && policyHolder == _other.policyHolder + && relationship == _other.relationship + && sequence == _other.sequence + && status == _other.status + && subscriber == _other.subscriber + && subscriberId == _other.subscriberId + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(beneficiary) + hasher.combine(contract) + hasher.combine(dependent) + hasher.combine(grouping) + hasher.combine(identifier) + hasher.combine(network) + hasher.combine(order) + hasher.combine(payor) + hasher.combine(period) + hasher.combine(policyHolder) + hasher.combine(relationship) + hasher.combine(sequence) + hasher.combine(status) + hasher.combine(subscriber) + hasher.combine(subscriberId) + hasher.combine(type) + } +} + +/** + Additional coverage classifications. + + A suite of underwrite specific classifiers, for example may be used to identify a class of coverage or employer group, + Policy, Plan. + */ +open class CoverageGrouping: BackboneElement { + + /// An identifier for the group + public var group: FHIRPrimitive? + + /// Display text for an identifier for the group + public var groupDisplay: FHIRPrimitive? + + /// An identifier for the subsection of the group + public var subGroup: FHIRPrimitive? + + /// Display text for the subsection of the group + public var subGroupDisplay: FHIRPrimitive? + + /// An identifier for the plan + public var plan: FHIRPrimitive? + + /// Display text for the plan + public var planDisplay: FHIRPrimitive? + + /// An identifier for the subsection of the plan + public var subPlan: FHIRPrimitive? + + /// Display text for the subsection of the plan + public var subPlanDisplay: FHIRPrimitive? + + /// An identifier for the class + public var `class`: FHIRPrimitive? + + /// Display text for the class + public var classDisplay: FHIRPrimitive? + + /// An identifier for the subsection of the class + public var subClass: FHIRPrimitive? + + /// Display text for the subsection of the subclass + public var subClassDisplay: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `class`: FHIRPrimitive? = nil, + classDisplay: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + group: FHIRPrimitive? = nil, + groupDisplay: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + plan: FHIRPrimitive? = nil, + planDisplay: FHIRPrimitive? = nil, + subClass: FHIRPrimitive? = nil, + subClassDisplay: FHIRPrimitive? = nil, + subGroup: FHIRPrimitive? = nil, + subGroupDisplay: FHIRPrimitive? = nil, + subPlan: FHIRPrimitive? = nil, + subPlanDisplay: FHIRPrimitive? = nil) + { + self.init() + self.`class` = `class` + self.classDisplay = classDisplay + self.`extension` = `extension` + self.group = group + self.groupDisplay = groupDisplay + self.id = id + self.modifierExtension = modifierExtension + self.plan = plan + self.planDisplay = planDisplay + self.subClass = subClass + self.subClassDisplay = subClassDisplay + self.subGroup = subGroup + self.subGroupDisplay = subGroupDisplay + self.subPlan = subPlan + self.subPlanDisplay = subPlanDisplay + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case `class` = "class"; case _class = "_class" + case classDisplay; case _classDisplay + case group; case _group + case groupDisplay; case _groupDisplay + case plan; case _plan + case planDisplay; case _planDisplay + case subClass; case _subClass + case subClassDisplay; case _subClassDisplay + case subGroup; case _subGroup + case subGroupDisplay; case _subGroupDisplay + case subPlan; case _subPlan + case subPlanDisplay; case _subPlanDisplay + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.`class` = try FHIRPrimitive(from: _container, forKeyIfPresent: .`class`, auxiliaryKey: ._class) + self.classDisplay = try FHIRPrimitive(from: _container, forKeyIfPresent: .classDisplay, auxiliaryKey: ._classDisplay) + self.group = try FHIRPrimitive(from: _container, forKeyIfPresent: .group, auxiliaryKey: ._group) + self.groupDisplay = try FHIRPrimitive(from: _container, forKeyIfPresent: .groupDisplay, auxiliaryKey: ._groupDisplay) + self.plan = try FHIRPrimitive(from: _container, forKeyIfPresent: .plan, auxiliaryKey: ._plan) + self.planDisplay = try FHIRPrimitive(from: _container, forKeyIfPresent: .planDisplay, auxiliaryKey: ._planDisplay) + self.subClass = try FHIRPrimitive(from: _container, forKeyIfPresent: .subClass, auxiliaryKey: ._subClass) + self.subClassDisplay = try FHIRPrimitive(from: _container, forKeyIfPresent: .subClassDisplay, auxiliaryKey: ._subClassDisplay) + self.subGroup = try FHIRPrimitive(from: _container, forKeyIfPresent: .subGroup, auxiliaryKey: ._subGroup) + self.subGroupDisplay = try FHIRPrimitive(from: _container, forKeyIfPresent: .subGroupDisplay, auxiliaryKey: ._subGroupDisplay) + self.subPlan = try FHIRPrimitive(from: _container, forKeyIfPresent: .subPlan, auxiliaryKey: ._subPlan) + self.subPlanDisplay = try FHIRPrimitive(from: _container, forKeyIfPresent: .subPlanDisplay, auxiliaryKey: ._subPlanDisplay) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try `class`?.encode(on: &_container, forKey: .`class`, auxiliaryKey: ._class) + try classDisplay?.encode(on: &_container, forKey: .classDisplay, auxiliaryKey: ._classDisplay) + try group?.encode(on: &_container, forKey: .group, auxiliaryKey: ._group) + try groupDisplay?.encode(on: &_container, forKey: .groupDisplay, auxiliaryKey: ._groupDisplay) + try plan?.encode(on: &_container, forKey: .plan, auxiliaryKey: ._plan) + try planDisplay?.encode(on: &_container, forKey: .planDisplay, auxiliaryKey: ._planDisplay) + try subClass?.encode(on: &_container, forKey: .subClass, auxiliaryKey: ._subClass) + try subClassDisplay?.encode(on: &_container, forKey: .subClassDisplay, auxiliaryKey: ._subClassDisplay) + try subGroup?.encode(on: &_container, forKey: .subGroup, auxiliaryKey: ._subGroup) + try subGroupDisplay?.encode(on: &_container, forKey: .subGroupDisplay, auxiliaryKey: ._subGroupDisplay) + try subPlan?.encode(on: &_container, forKey: .subPlan, auxiliaryKey: ._subPlan) + try subPlanDisplay?.encode(on: &_container, forKey: .subPlanDisplay, auxiliaryKey: ._subPlanDisplay) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? CoverageGrouping else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return `class` == _other.`class` + && classDisplay == _other.classDisplay + && group == _other.group + && groupDisplay == _other.groupDisplay + && plan == _other.plan + && planDisplay == _other.planDisplay + && subClass == _other.subClass + && subClassDisplay == _other.subClassDisplay + && subGroup == _other.subGroup + && subGroupDisplay == _other.subGroupDisplay + && subPlan == _other.subPlan + && subPlanDisplay == _other.subPlanDisplay + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(`class`) + hasher.combine(classDisplay) + hasher.combine(group) + hasher.combine(groupDisplay) + hasher.combine(plan) + hasher.combine(planDisplay) + hasher.combine(subClass) + hasher.combine(subClassDisplay) + hasher.combine(subGroup) + hasher.combine(subGroupDisplay) + hasher.combine(subPlan) + hasher.combine(subPlanDisplay) + } +} diff --git a/Sources/ModelsSTU3/DataElement.swift b/Sources/ModelsSTU3/DataElement.swift new file mode 100644 index 0000000..b8aea86 --- /dev/null +++ b/Sources/ModelsSTU3/DataElement.swift @@ -0,0 +1,355 @@ +// +// DataElement.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DataElement) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Resource data element. + + The formal description of a single piece of information that can be gathered and reported. + */ +open class DataElement: DomainResource { + + override open class var resourceType: ResourceType { return .dataElement } + + /// Logical URI to reference this data element (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the data element + public var identifier: [Identifier]? + + /// Business version of the data element + public var version: FHIRPrimitive? + + /// The status of this data element. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Name for this data element (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this data element (human friendly) + public var title: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for data element (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Identifies how precise the data element is in its definition. + public var stringency: FHIRPrimitive? + + /// External specification mapped to + public var mapping: [DataElementMapping]? + + /// Definition of element + public var element: [ElementDefinition] + + /// Designated initializer taking all required properties + public init(element: [ElementDefinition], status: FHIRPrimitive) { + self.element = element + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + element: [ElementDefinition], + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + mapping: [DataElementMapping]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + publisher: FHIRPrimitive? = nil, + status: FHIRPrimitive, + stringency: FHIRPrimitive? = nil, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(element: element, status: status) + self.contact = contact + self.contained = contained + self.copyright = copyright + self.date = date + self.experimental = experimental + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.mapping = mapping + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.publisher = publisher + self.stringency = stringency + self.text = text + self.title = title + self.url = url + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contact + case copyright; case _copyright + case date; case _date + case element + case experimental; case _experimental + case identifier + case jurisdiction + case mapping + case name; case _name + case publisher; case _publisher + case status; case _status + case stringency; case _stringency + case title; case _title + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.element = try [ElementDefinition](from: _container, forKey: .element) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.mapping = try [DataElementMapping](from: _container, forKeyIfPresent: .mapping) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.stringency = try FHIRPrimitive(from: _container, forKeyIfPresent: .stringency, auxiliaryKey: ._stringency) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contact?.encode(on: &_container, forKey: .contact) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try element.encode(on: &_container, forKey: .element) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try mapping?.encode(on: &_container, forKey: .mapping) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try stringency?.encode(on: &_container, forKey: .stringency, auxiliaryKey: ._stringency) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DataElement else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contact == _other.contact + && copyright == _other.copyright + && date == _other.date + && element == _other.element + && experimental == _other.experimental + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && mapping == _other.mapping + && name == _other.name + && publisher == _other.publisher + && status == _other.status + && stringency == _other.stringency + && title == _other.title + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contact) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(element) + hasher.combine(experimental) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(mapping) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(status) + hasher.combine(stringency) + hasher.combine(title) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + External specification mapped to. + + Identifies a specification (other than a terminology) that the elements which make up the DataElement have some + correspondence with. + */ +open class DataElementMapping: BackboneElement { + + /// Internal id when this mapping is used + public var identity: FHIRPrimitive + + /// Identifies what this mapping refers to + public var uri: FHIRPrimitive? + + /// Names what this mapping refers to + public var name: FHIRPrimitive? + + /// Versions, issues, scope limitations, etc. + public var comment: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(identity: FHIRPrimitive) { + self.identity = identity + super.init() + } + + /// Convenience initializer + public convenience init( + comment: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identity: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + uri: FHIRPrimitive? = nil) + { + self.init(identity: identity) + self.comment = comment + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.name = name + self.uri = uri + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case comment; case _comment + case identity; case _identity + case name; case _name + case uri; case _uri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.identity = try FHIRPrimitive(from: _container, forKey: .identity, auxiliaryKey: ._identity) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.uri = try FHIRPrimitive(from: _container, forKeyIfPresent: .uri, auxiliaryKey: ._uri) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try identity.encode(on: &_container, forKey: .identity, auxiliaryKey: ._identity) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try uri?.encode(on: &_container, forKey: .uri, auxiliaryKey: ._uri) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DataElementMapping else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return comment == _other.comment + && identity == _other.identity + && name == _other.name + && uri == _other.uri + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(comment) + hasher.combine(identity) + hasher.combine(name) + hasher.combine(uri) + } +} diff --git a/Sources/ModelsSTU3/DataRequirement.swift b/Sources/ModelsSTU3/DataRequirement.swift new file mode 100644 index 0000000..0aef180 --- /dev/null +++ b/Sources/ModelsSTU3/DataRequirement.swift @@ -0,0 +1,385 @@ +// +// DataRequirement.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DataRequirement) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Describes a required data item. + + Describes a required data item for evaluation in terms of the type of data, and optional code or date-based filters of + the data. + */ +open class DataRequirement: Element { + + /// The type of the required data + public var type: FHIRPrimitive + + /// The profile of the required data + public var profile: [FHIRPrimitive]? + + /// Indicates that specific structure elements are referenced by the knowledge module + public var mustSupport: [FHIRPrimitive]? + + /// What codes are expected + public var codeFilter: [DataRequirementCodeFilter]? + + /// What dates/date ranges are expected + public var dateFilter: [DataRequirementDateFilter]? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + codeFilter: [DataRequirementCodeFilter]? = nil, + dateFilter: [DataRequirementDateFilter]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + mustSupport: [FHIRPrimitive]? = nil, + profile: [FHIRPrimitive]? = nil, + type: FHIRPrimitive) + { + self.init(type: type) + self.codeFilter = codeFilter + self.dateFilter = dateFilter + self.`extension` = `extension` + self.id = id + self.mustSupport = mustSupport + self.profile = profile + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case codeFilter + case dateFilter + case mustSupport; case _mustSupport + case profile; case _profile + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.codeFilter = try [DataRequirementCodeFilter](from: _container, forKeyIfPresent: .codeFilter) + self.dateFilter = try [DataRequirementDateFilter](from: _container, forKeyIfPresent: .dateFilter) + self.mustSupport = try [FHIRPrimitive](from: _container, forKeyIfPresent: .mustSupport, auxiliaryKey: ._mustSupport) + self.profile = try [FHIRPrimitive](from: _container, forKeyIfPresent: .profile, auxiliaryKey: ._profile) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try codeFilter?.encode(on: &_container, forKey: .codeFilter) + try dateFilter?.encode(on: &_container, forKey: .dateFilter) + try mustSupport?.encode(on: &_container, forKey: .mustSupport, auxiliaryKey: ._mustSupport) + try profile?.encode(on: &_container, forKey: .profile, auxiliaryKey: ._profile) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DataRequirement else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return codeFilter == _other.codeFilter + && dateFilter == _other.dateFilter + && mustSupport == _other.mustSupport + && profile == _other.profile + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(codeFilter) + hasher.combine(dateFilter) + hasher.combine(mustSupport) + hasher.combine(profile) + hasher.combine(type) + } +} + +/** + What codes are expected. + + Code filters specify additional constraints on the data, specifying the value set of interest for a particular element + of the data. + */ +open class DataRequirementCodeFilter: Element { + + /// All possible types for "valueSet[x]" + public enum ValueSetX: Hashable { + case reference(Reference) + case string(FHIRPrimitive) + } + + /// The code-valued attribute of the filter + public var path: FHIRPrimitive + + /// Valueset for the filter + /// One of `valueSet[x]` + public var valueSet: ValueSetX? + + /// What code is expected + public var valueCode: [FHIRPrimitive]? + + /// What Coding is expected + public var valueCoding: [Coding]? + + /// What CodeableConcept is expected + public var valueCodeableConcept: [CodeableConcept]? + + /// Designated initializer taking all required properties + public init(path: FHIRPrimitive) { + self.path = path + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + path: FHIRPrimitive, + valueCode: [FHIRPrimitive]? = nil, + valueCodeableConcept: [CodeableConcept]? = nil, + valueCoding: [Coding]? = nil, + valueSet: ValueSetX? = nil) + { + self.init(path: path) + self.`extension` = `extension` + self.id = id + self.valueCode = valueCode + self.valueCodeableConcept = valueCodeableConcept + self.valueCoding = valueCoding + self.valueSet = valueSet + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case path; case _path + case valueCode; case _valueCode + case valueCodeableConcept + case valueCoding + case valueSetReference + case valueSetString; case _valueSetString + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.path = try FHIRPrimitive(from: _container, forKey: .path, auxiliaryKey: ._path) + self.valueCode = try [FHIRPrimitive](from: _container, forKeyIfPresent: .valueCode, auxiliaryKey: ._valueCode) + self.valueCodeableConcept = try [CodeableConcept](from: _container, forKeyIfPresent: .valueCodeableConcept) + self.valueCoding = try [Coding](from: _container, forKeyIfPresent: .valueCoding) + var _t_valueSet: ValueSetX? = nil + if let valueSetString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueSetString, auxiliaryKey: ._valueSetString) { + if _t_valueSet != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSetString, in: _container, debugDescription: "More than one value provided for \"valueSet\"") + } + _t_valueSet = .string(valueSetString) + } + if let valueSetReference = try Reference(from: _container, forKeyIfPresent: .valueSetReference) { + if _t_valueSet != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSetReference, in: _container, debugDescription: "More than one value provided for \"valueSet\"") + } + _t_valueSet = .reference(valueSetReference) + } + self.valueSet = _t_valueSet + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try path.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + try valueCode?.encode(on: &_container, forKey: .valueCode, auxiliaryKey: ._valueCode) + try valueCodeableConcept?.encode(on: &_container, forKey: .valueCodeableConcept) + try valueCoding?.encode(on: &_container, forKey: .valueCoding) + if let _enum = valueSet { + switch _enum { + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueSetString, auxiliaryKey: ._valueSetString) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueSetReference) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DataRequirementCodeFilter else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return path == _other.path + && valueCode == _other.valueCode + && valueCodeableConcept == _other.valueCodeableConcept + && valueCoding == _other.valueCoding + && valueSet == _other.valueSet + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(path) + hasher.combine(valueCode) + hasher.combine(valueCodeableConcept) + hasher.combine(valueCoding) + hasher.combine(valueSet) + } +} + +/** + What dates/date ranges are expected. + + Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. + */ +open class DataRequirementDateFilter: Element { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case dateTime(FHIRPrimitive) + case duration(Duration) + case period(Period) + } + + /// The date-valued attribute of the filter + public var path: FHIRPrimitive + + /// The value of the filter, as a Period, DateTime, or Duration value + /// One of `value[x]` + public var value: ValueX? + + /// Designated initializer taking all required properties + public init(path: FHIRPrimitive) { + self.path = path + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + path: FHIRPrimitive, + value: ValueX? = nil) + { + self.init(path: path) + self.`extension` = `extension` + self.id = id + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case path; case _path + case valueDateTime; case _valueDateTime + case valueDuration + case valuePeriod + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.path = try FHIRPrimitive(from: _container, forKey: .path, auxiliaryKey: ._path) + var _t_value: ValueX? = nil + if let valueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDateTime, auxiliaryKey: ._valueDateTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDateTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .dateTime(valueDateTime) + } + if let valuePeriod = try Period(from: _container, forKeyIfPresent: .valuePeriod) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePeriod, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .period(valuePeriod) + } + if let valueDuration = try Duration(from: _container, forKeyIfPresent: .valueDuration) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDuration, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .duration(valueDuration) + } + self.value = _t_value + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try path.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + if let _enum = value { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .valueDateTime, auxiliaryKey: ._valueDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .valuePeriod) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .valueDuration) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DataRequirementDateFilter else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return path == _other.path + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(path) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/DateTime.swift b/Sources/ModelsSTU3/DateTime.swift new file mode 100644 index 0000000..4be14fd --- /dev/null +++ b/Sources/ModelsSTU3/DateTime.swift @@ -0,0 +1,154 @@ +// +// DateTime.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import FMCore + +/** + A date, date-time or partial date (e.g. just year or year + month). If hours and minutes are specified, a time SHALL + be populated. The format is a union of the schema types gYear, gYearMonth, date and dateTime. Seconds must be + provided due to schema type constraints but may be zero-filled and may be ignored. Dates SHALL be valid dates. + + There are slight variations in permitted members, see FHIRDate's and FHIRTime's descriptions. + + http://hl7.org/fhir/datatypes.html#datetime + */ +public struct DateTime: FHIRPrimitiveType { + + private var _timeZoneIsUnaltered = true + + public var date: FHIRDate + + public var time: FHIRTime? + + public var timeZone: TimeZone? { + didSet { + _timeZoneIsUnaltered = false + } + } + + public let originalTimeZoneString: String? + + /** + Preferred initializer. You can only have a time if you have a timezone. + */ + public init(date: FHIRDate, time: FHIRTime? = nil, timezone: TimeZone? = nil) { + self.init(date: date, time: time, timezone: timezone, originalTimeZoneString: nil) + } + + public init(_ originalString: String) throws { + let scanner = Scanner(string: originalString) + let (date, time, timezone, timeZoneString) = try DateTime.parse(from: scanner) + self.init(date: date, time: time, timezone: timezone, originalTimeZoneString: timeZoneString) + } + + /** + Designated, private initializer. You can only have a time if you have a timezone. + */ + private init(date: FHIRDate, time: FHIRTime? = nil, timezone: TimeZone? = nil, originalTimeZoneString: String? = nil) { + self.date = date + self.time = time + self.timeZone = timezone + self.originalTimeZoneString = originalTimeZoneString + } + + // MARK: Parsing + + /// Parse valid "datetime" strings. + public static func parse(from scanner: Scanner, expectAtEnd: Bool = true) throws -> (date: FHIRDate, time: FHIRTime?, timezone: TimeZone?, timeZoneString: String?) { + let originalCharactersToBeSkipped = scanner.charactersToBeSkipped + defer { scanner.charactersToBeSkipped = originalCharactersToBeSkipped } + scanner.charactersToBeSkipped = nil + + // Date + let date = try FHIRDate.parse(from: scanner, expectAtEnd: false) + var time: FHIRTime? = nil + var timeZone: TimeZone? = nil + var timeZoneString: String? = nil + + // Time + if scanner.scanString("T", into: nil) { + time = try FHIRTime.parse(from: scanner, expectAtEnd: false) + + // TimeZone + let (secondsFromGMT, tzString) = try TimeZone.hs_parseComponents(from: scanner, expectAtEnd: true) + timeZone = TimeZone(secondsFromGMT: secondsFromGMT) + timeZoneString = tzString + } + + // At end + let scanLocation = scanner.scanLocation + if expectAtEnd && !scanner.isAtEnd { // it's OK if we don't `expectAtEnd` but the scanner actually is + throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + return (date, time, timeZone, timeZoneString) + } +} + +// MARK: - + +extension DateTime: ExpressibleByStringLiteral { + + public init(stringLiteral value: StringLiteralType) { + try! self.init(value) + } +} + +extension DateTime: Decodable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + let string = try container.decode(String.self) + try self.init(string) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(description) + } +} + +extension DateTime: CustomStringConvertible { + + public var description: String { + if let time = time, let timeZone = timeZone { + if _timeZoneIsUnaltered, let originalTimeZoneString = originalTimeZoneString { + return String(format: "%@T%@%@", date.description, time.description, originalTimeZoneString) + } + return String(format: "%@T%@%@", date.description, time.description, timeZone.fhirDescription) + } + return date.description + } +} + +extension DateTime: Equatable { + + public static func ==(l: DateTime, r: DateTime) -> Bool { + if l.date != r.date { + return false + } + if l.time != r.time { + return false + } + if l.timeZone != r.timeZone { + return false + } + return true + } +} diff --git a/Sources/ModelsSTU3/DetectedIssue.swift b/Sources/ModelsSTU3/DetectedIssue.swift new file mode 100644 index 0000000..236d408 --- /dev/null +++ b/Sources/ModelsSTU3/DetectedIssue.swift @@ -0,0 +1,298 @@ +// +// DetectedIssue.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DetectedIssue) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Clinical issue with action. + + Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a + patient; e.g. Drug-drug interaction, Ineffective treatment frequency, Procedure-condition conflict, etc. + */ +open class DetectedIssue: DomainResource { + + override open class var resourceType: ResourceType { return .detectedIssue } + + /// Unique id for the detected issue + public var identifier: Identifier? + + /// Indicates the status of the detected issue. + public var status: FHIRPrimitive + + /// Issue Category, e.g. drug-drug, duplicate therapy, etc. + public var category: CodeableConcept? + + /// Indicates the degree of importance associated with the identified issue based on the potential impact on the + /// patient. + public var severity: FHIRPrimitive? + + /// Associated patient + public var patient: Reference? + + /// When identified + public var date: FHIRPrimitive? + + /// The provider or device that identified the issue + public var author: Reference? + + /// Problem resource + public var implicated: [Reference]? + + /// Description and context + public var detail: FHIRPrimitive? + + /// Authority for issue + public var reference: FHIRPrimitive? + + /// Step taken to address + public var mitigation: [DetectedIssueMitigation]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + author: Reference? = nil, + category: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + detail: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicated: [Reference]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + mitigation: [DetectedIssueMitigation]? = nil, + modifierExtension: [Extension]? = nil, + patient: Reference? = nil, + reference: FHIRPrimitive? = nil, + severity: FHIRPrimitive? = nil, + status: FHIRPrimitive, + text: Narrative? = nil) + { + self.init(status: status) + self.author = author + self.category = category + self.contained = contained + self.date = date + self.detail = detail + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicated = implicated + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.mitigation = mitigation + self.modifierExtension = modifierExtension + self.patient = patient + self.reference = reference + self.severity = severity + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case author + case category + case date; case _date + case detail; case _detail + case identifier + case implicated + case mitigation + case patient + case reference; case _reference + case severity; case _severity + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.author = try Reference(from: _container, forKeyIfPresent: .author) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.detail = try FHIRPrimitive(from: _container, forKeyIfPresent: .detail, auxiliaryKey: ._detail) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.implicated = try [Reference](from: _container, forKeyIfPresent: .implicated) + self.mitigation = try [DetectedIssueMitigation](from: _container, forKeyIfPresent: .mitigation) + self.patient = try Reference(from: _container, forKeyIfPresent: .patient) + self.reference = try FHIRPrimitive(from: _container, forKeyIfPresent: .reference, auxiliaryKey: ._reference) + self.severity = try FHIRPrimitive(from: _container, forKeyIfPresent: .severity, auxiliaryKey: ._severity) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try author?.encode(on: &_container, forKey: .author) + try category?.encode(on: &_container, forKey: .category) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try detail?.encode(on: &_container, forKey: .detail, auxiliaryKey: ._detail) + try identifier?.encode(on: &_container, forKey: .identifier) + try implicated?.encode(on: &_container, forKey: .implicated) + try mitigation?.encode(on: &_container, forKey: .mitigation) + try patient?.encode(on: &_container, forKey: .patient) + try reference?.encode(on: &_container, forKey: .reference, auxiliaryKey: ._reference) + try severity?.encode(on: &_container, forKey: .severity, auxiliaryKey: ._severity) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DetectedIssue else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return author == _other.author + && category == _other.category + && date == _other.date + && detail == _other.detail + && identifier == _other.identifier + && implicated == _other.implicated + && mitigation == _other.mitigation + && patient == _other.patient + && reference == _other.reference + && severity == _other.severity + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(author) + hasher.combine(category) + hasher.combine(date) + hasher.combine(detail) + hasher.combine(identifier) + hasher.combine(implicated) + hasher.combine(mitigation) + hasher.combine(patient) + hasher.combine(reference) + hasher.combine(severity) + hasher.combine(status) + } +} + +/** + Step taken to address. + + Indicates an action that has been taken or is committed to to reduce or eliminate the likelihood of the risk identified + by the detected issue from manifesting. Can also reflect an observation of known mitigating factors that may + reduce/eliminate the need for any action. + */ +open class DetectedIssueMitigation: BackboneElement { + + /// What mitigation? + public var action: CodeableConcept + + /// Date committed + public var date: FHIRPrimitive? + + /// Who is committing? + public var author: Reference? + + /// Designated initializer taking all required properties + public init(action: CodeableConcept) { + self.action = action + super.init() + } + + /// Convenience initializer + public convenience init( + action: CodeableConcept, + author: Reference? = nil, + date: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(action: action) + self.author = author + self.date = date + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case author + case date; case _date + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try CodeableConcept(from: _container, forKey: .action) + self.author = try Reference(from: _container, forKeyIfPresent: .author) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action.encode(on: &_container, forKey: .action) + try author?.encode(on: &_container, forKey: .author) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DetectedIssueMitigation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && author == _other.author + && date == _other.date + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(author) + hasher.combine(date) + } +} diff --git a/Sources/ModelsSTU3/Device.swift b/Sources/ModelsSTU3/Device.swift new file mode 100644 index 0000000..c450b23 --- /dev/null +++ b/Sources/ModelsSTU3/Device.swift @@ -0,0 +1,398 @@ +// +// Device.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Device) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Item used in healthcare. + + This resource identifies an instance or a type of a manufactured item that is used in the provision of healthcare + without being substantially changed through that activity. The device may be a medical or non-medical device. Medical + devices include durable (reusable) medical equipment, implantable devices, as well as disposable equipment used for + diagnostic, treatment, and research for healthcare and public health. Non-medical devices may include items such as a + machine, cellphone, computer, application, etc. + */ +open class Device: DomainResource { + + override open class var resourceType: ResourceType { return .device } + + /// Instance identifier + public var identifier: [Identifier]? + + /// Unique Device Identifier (UDI) Barcode string + public var udi: DeviceUdi? + + /// Status of the Device availability. + public var status: FHIRPrimitive? + + /// What kind of device this is + public var type: CodeableConcept? + + /// Lot number of manufacture + public var lotNumber: FHIRPrimitive? + + /// Name of device manufacturer + public var manufacturer: FHIRPrimitive? + + /// Date when the device was made + public var manufactureDate: FHIRPrimitive? + + /// Date and time of expiry of this device (if applicable) + public var expirationDate: FHIRPrimitive? + + /// Model id assigned by the manufacturer + public var model: FHIRPrimitive? + + /// Version number (i.e. software) + public var version: FHIRPrimitive? + + /// Patient to whom Device is affixed + public var patient: Reference? + + /// Organization responsible for device + public var owner: Reference? + + /// Details for human/organization for support + public var contact: [ContactPoint]? + + /// Where the resource is found + public var location: Reference? + + /// Network address to contact device + public var url: FHIRPrimitive? + + /// Device notes and comments + public var note: [Annotation]? + + /// Safety Characteristics of Device + public var safety: [CodeableConcept]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + contact: [ContactPoint]? = nil, + contained: [ResourceProxy]? = nil, + expirationDate: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + location: Reference? = nil, + lotNumber: FHIRPrimitive? = nil, + manufactureDate: FHIRPrimitive? = nil, + manufacturer: FHIRPrimitive? = nil, + meta: Meta? = nil, + model: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + owner: Reference? = nil, + patient: Reference? = nil, + safety: [CodeableConcept]? = nil, + status: FHIRPrimitive? = nil, + text: Narrative? = nil, + type: CodeableConcept? = nil, + udi: DeviceUdi? = nil, + url: FHIRPrimitive? = nil, + version: FHIRPrimitive? = nil) + { + self.init() + self.contact = contact + self.contained = contained + self.expirationDate = expirationDate + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.location = location + self.lotNumber = lotNumber + self.manufactureDate = manufactureDate + self.manufacturer = manufacturer + self.meta = meta + self.model = model + self.modifierExtension = modifierExtension + self.note = note + self.owner = owner + self.patient = patient + self.safety = safety + self.status = status + self.text = text + self.type = type + self.udi = udi + self.url = url + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contact + case expirationDate; case _expirationDate + case identifier + case location + case lotNumber; case _lotNumber + case manufactureDate; case _manufactureDate + case manufacturer; case _manufacturer + case model; case _model + case note + case owner + case patient + case safety + case status; case _status + case type + case udi + case url; case _url + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contact = try [ContactPoint](from: _container, forKeyIfPresent: .contact) + self.expirationDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .expirationDate, auxiliaryKey: ._expirationDate) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.location = try Reference(from: _container, forKeyIfPresent: .location) + self.lotNumber = try FHIRPrimitive(from: _container, forKeyIfPresent: .lotNumber, auxiliaryKey: ._lotNumber) + self.manufactureDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .manufactureDate, auxiliaryKey: ._manufactureDate) + self.manufacturer = try FHIRPrimitive(from: _container, forKeyIfPresent: .manufacturer, auxiliaryKey: ._manufacturer) + self.model = try FHIRPrimitive(from: _container, forKeyIfPresent: .model, auxiliaryKey: ._model) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.owner = try Reference(from: _container, forKeyIfPresent: .owner) + self.patient = try Reference(from: _container, forKeyIfPresent: .patient) + self.safety = try [CodeableConcept](from: _container, forKeyIfPresent: .safety) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + self.udi = try DeviceUdi(from: _container, forKeyIfPresent: .udi) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contact?.encode(on: &_container, forKey: .contact) + try expirationDate?.encode(on: &_container, forKey: .expirationDate, auxiliaryKey: ._expirationDate) + try identifier?.encode(on: &_container, forKey: .identifier) + try location?.encode(on: &_container, forKey: .location) + try lotNumber?.encode(on: &_container, forKey: .lotNumber, auxiliaryKey: ._lotNumber) + try manufactureDate?.encode(on: &_container, forKey: .manufactureDate, auxiliaryKey: ._manufactureDate) + try manufacturer?.encode(on: &_container, forKey: .manufacturer, auxiliaryKey: ._manufacturer) + try model?.encode(on: &_container, forKey: .model, auxiliaryKey: ._model) + try note?.encode(on: &_container, forKey: .note) + try owner?.encode(on: &_container, forKey: .owner) + try patient?.encode(on: &_container, forKey: .patient) + try safety?.encode(on: &_container, forKey: .safety) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try type?.encode(on: &_container, forKey: .type) + try udi?.encode(on: &_container, forKey: .udi) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Device else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contact == _other.contact + && expirationDate == _other.expirationDate + && identifier == _other.identifier + && location == _other.location + && lotNumber == _other.lotNumber + && manufactureDate == _other.manufactureDate + && manufacturer == _other.manufacturer + && model == _other.model + && note == _other.note + && owner == _other.owner + && patient == _other.patient + && safety == _other.safety + && status == _other.status + && type == _other.type + && udi == _other.udi + && url == _other.url + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contact) + hasher.combine(expirationDate) + hasher.combine(identifier) + hasher.combine(location) + hasher.combine(lotNumber) + hasher.combine(manufactureDate) + hasher.combine(manufacturer) + hasher.combine(model) + hasher.combine(note) + hasher.combine(owner) + hasher.combine(patient) + hasher.combine(safety) + hasher.combine(status) + hasher.combine(type) + hasher.combine(udi) + hasher.combine(url) + hasher.combine(version) + } +} + +/** + Unique Device Identifier (UDI) Barcode string. + + [Unique device identifier (UDI)](device.html#5.11.3.2.2) assigned to device label or package. + */ +open class DeviceUdi: BackboneElement { + + /// Mandatory fixed portion of UDI + public var deviceIdentifier: FHIRPrimitive? + + /// Device Name as appears on UDI label + public var name: FHIRPrimitive? + + /// Regional UDI authority + public var jurisdiction: FHIRPrimitive? + + /// UDI Human Readable Barcode String + public var carrierHRF: FHIRPrimitive? + + /// UDI Machine Readable Barcode String + public var carrierAIDC: FHIRPrimitive? + + /// UDI Issuing Organization + public var issuer: FHIRPrimitive? + + /// A coded entry to indicate how the data was entered. + public var entryType: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + carrierAIDC: FHIRPrimitive? = nil, + carrierHRF: FHIRPrimitive? = nil, + deviceIdentifier: FHIRPrimitive? = nil, + entryType: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + issuer: FHIRPrimitive? = nil, + jurisdiction: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil) + { + self.init() + self.carrierAIDC = carrierAIDC + self.carrierHRF = carrierHRF + self.deviceIdentifier = deviceIdentifier + self.entryType = entryType + self.`extension` = `extension` + self.id = id + self.issuer = issuer + self.jurisdiction = jurisdiction + self.modifierExtension = modifierExtension + self.name = name + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case carrierAIDC; case _carrierAIDC + case carrierHRF; case _carrierHRF + case deviceIdentifier; case _deviceIdentifier + case entryType; case _entryType + case issuer; case _issuer + case jurisdiction; case _jurisdiction + case name; case _name + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.carrierAIDC = try FHIRPrimitive(from: _container, forKeyIfPresent: .carrierAIDC, auxiliaryKey: ._carrierAIDC) + self.carrierHRF = try FHIRPrimitive(from: _container, forKeyIfPresent: .carrierHRF, auxiliaryKey: ._carrierHRF) + self.deviceIdentifier = try FHIRPrimitive(from: _container, forKeyIfPresent: .deviceIdentifier, auxiliaryKey: ._deviceIdentifier) + self.entryType = try FHIRPrimitive(from: _container, forKeyIfPresent: .entryType, auxiliaryKey: ._entryType) + self.issuer = try FHIRPrimitive(from: _container, forKeyIfPresent: .issuer, auxiliaryKey: ._issuer) + self.jurisdiction = try FHIRPrimitive(from: _container, forKeyIfPresent: .jurisdiction, auxiliaryKey: ._jurisdiction) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try carrierAIDC?.encode(on: &_container, forKey: .carrierAIDC, auxiliaryKey: ._carrierAIDC) + try carrierHRF?.encode(on: &_container, forKey: .carrierHRF, auxiliaryKey: ._carrierHRF) + try deviceIdentifier?.encode(on: &_container, forKey: .deviceIdentifier, auxiliaryKey: ._deviceIdentifier) + try entryType?.encode(on: &_container, forKey: .entryType, auxiliaryKey: ._entryType) + try issuer?.encode(on: &_container, forKey: .issuer, auxiliaryKey: ._issuer) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction, auxiliaryKey: ._jurisdiction) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DeviceUdi else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return carrierAIDC == _other.carrierAIDC + && carrierHRF == _other.carrierHRF + && deviceIdentifier == _other.deviceIdentifier + && entryType == _other.entryType + && issuer == _other.issuer + && jurisdiction == _other.jurisdiction + && name == _other.name + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(carrierAIDC) + hasher.combine(carrierHRF) + hasher.combine(deviceIdentifier) + hasher.combine(entryType) + hasher.combine(issuer) + hasher.combine(jurisdiction) + hasher.combine(name) + } +} diff --git a/Sources/ModelsSTU3/DeviceComponent.swift b/Sources/ModelsSTU3/DeviceComponent.swift new file mode 100644 index 0000000..a458b32 --- /dev/null +++ b/Sources/ModelsSTU3/DeviceComponent.swift @@ -0,0 +1,284 @@ +// +// DeviceComponent.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DeviceComponent) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + An instance of a medical-related component of a medical device. + + The characteristics, operational status and capabilities of a medical-related component of a medical device. + */ +open class DeviceComponent: DomainResource { + + override open class var resourceType: ResourceType { return .deviceComponent } + + /// Instance id assigned by the software stack + public var identifier: Identifier + + /// What kind of component it is + public var type: CodeableConcept + + /// Recent system change timestamp + public var lastSystemChange: FHIRPrimitive? + + /// Top-level device resource link + public var source: Reference? + + /// Parent resource link + public var parent: Reference? + + /// Current operational status of the component, for example On, Off or Standby + public var operationalStatus: [CodeableConcept]? + + /// Current supported parameter group + public var parameterGroup: CodeableConcept? + + /// The physical principle of the measurement. For example: thermal, chemical, acoustical, etc. + public var measurementPrinciple: FHIRPrimitive? + + /// Specification details such as Component Revisions, or Serial Numbers + public var productionSpecification: [DeviceComponentProductionSpecification]? + + /// Language code for the human-readable text strings produced by the device + public var languageCode: CodeableConcept? + + /// Designated initializer taking all required properties + public init(identifier: Identifier, type: CodeableConcept) { + self.identifier = identifier + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + languageCode: CodeableConcept? = nil, + lastSystemChange: FHIRPrimitive? = nil, + measurementPrinciple: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + operationalStatus: [CodeableConcept]? = nil, + parameterGroup: CodeableConcept? = nil, + parent: Reference? = nil, + productionSpecification: [DeviceComponentProductionSpecification]? = nil, + source: Reference? = nil, + text: Narrative? = nil, + type: CodeableConcept) + { + self.init(identifier: identifier, type: type) + self.contained = contained + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.language = language + self.languageCode = languageCode + self.lastSystemChange = lastSystemChange + self.measurementPrinciple = measurementPrinciple + self.meta = meta + self.modifierExtension = modifierExtension + self.operationalStatus = operationalStatus + self.parameterGroup = parameterGroup + self.parent = parent + self.productionSpecification = productionSpecification + self.source = source + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case identifier + case languageCode + case lastSystemChange; case _lastSystemChange + case measurementPrinciple; case _measurementPrinciple + case operationalStatus + case parameterGroup + case parent + case productionSpecification + case source + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.identifier = try Identifier(from: _container, forKey: .identifier) + self.languageCode = try CodeableConcept(from: _container, forKeyIfPresent: .languageCode) + self.lastSystemChange = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastSystemChange, auxiliaryKey: ._lastSystemChange) + self.measurementPrinciple = try FHIRPrimitive(from: _container, forKeyIfPresent: .measurementPrinciple, auxiliaryKey: ._measurementPrinciple) + self.operationalStatus = try [CodeableConcept](from: _container, forKeyIfPresent: .operationalStatus) + self.parameterGroup = try CodeableConcept(from: _container, forKeyIfPresent: .parameterGroup) + self.parent = try Reference(from: _container, forKeyIfPresent: .parent) + self.productionSpecification = try [DeviceComponentProductionSpecification](from: _container, forKeyIfPresent: .productionSpecification) + self.source = try Reference(from: _container, forKeyIfPresent: .source) + self.type = try CodeableConcept(from: _container, forKey: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try identifier.encode(on: &_container, forKey: .identifier) + try languageCode?.encode(on: &_container, forKey: .languageCode) + try lastSystemChange?.encode(on: &_container, forKey: .lastSystemChange, auxiliaryKey: ._lastSystemChange) + try measurementPrinciple?.encode(on: &_container, forKey: .measurementPrinciple, auxiliaryKey: ._measurementPrinciple) + try operationalStatus?.encode(on: &_container, forKey: .operationalStatus) + try parameterGroup?.encode(on: &_container, forKey: .parameterGroup) + try parent?.encode(on: &_container, forKey: .parent) + try productionSpecification?.encode(on: &_container, forKey: .productionSpecification) + try source?.encode(on: &_container, forKey: .source) + try type.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DeviceComponent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return identifier == _other.identifier + && languageCode == _other.languageCode + && lastSystemChange == _other.lastSystemChange + && measurementPrinciple == _other.measurementPrinciple + && operationalStatus == _other.operationalStatus + && parameterGroup == _other.parameterGroup + && parent == _other.parent + && productionSpecification == _other.productionSpecification + && source == _other.source + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(identifier) + hasher.combine(languageCode) + hasher.combine(lastSystemChange) + hasher.combine(measurementPrinciple) + hasher.combine(operationalStatus) + hasher.combine(parameterGroup) + hasher.combine(parent) + hasher.combine(productionSpecification) + hasher.combine(source) + hasher.combine(type) + } +} + +/** + Specification details such as Component Revisions, or Serial Numbers. + + The production specification such as component revision, serial number, etc. + */ +open class DeviceComponentProductionSpecification: BackboneElement { + + /// Type or kind of production specification, for example serial number or software revision + public var specType: CodeableConcept? + + /// Internal component unique identification + public var componentId: Identifier? + + /// A printable string defining the component + public var productionSpec: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + componentId: Identifier? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + productionSpec: FHIRPrimitive? = nil, + specType: CodeableConcept? = nil) + { + self.init() + self.componentId = componentId + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.productionSpec = productionSpec + self.specType = specType + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case componentId + case productionSpec; case _productionSpec + case specType + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.componentId = try Identifier(from: _container, forKeyIfPresent: .componentId) + self.productionSpec = try FHIRPrimitive(from: _container, forKeyIfPresent: .productionSpec, auxiliaryKey: ._productionSpec) + self.specType = try CodeableConcept(from: _container, forKeyIfPresent: .specType) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try componentId?.encode(on: &_container, forKey: .componentId) + try productionSpec?.encode(on: &_container, forKey: .productionSpec, auxiliaryKey: ._productionSpec) + try specType?.encode(on: &_container, forKey: .specType) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DeviceComponentProductionSpecification else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return componentId == _other.componentId + && productionSpec == _other.productionSpec + && specType == _other.specType + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(componentId) + hasher.combine(productionSpec) + hasher.combine(specType) + } +} diff --git a/Sources/ModelsSTU3/DeviceMetric.swift b/Sources/ModelsSTU3/DeviceMetric.swift new file mode 100644 index 0000000..8ad6add --- /dev/null +++ b/Sources/ModelsSTU3/DeviceMetric.swift @@ -0,0 +1,286 @@ +// +// DeviceMetric.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DeviceMetric) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Measurement, calculation or setting capability of a medical device. + + Describes a measurement, calculation or setting capability of a medical device. + */ +open class DeviceMetric: DomainResource { + + override open class var resourceType: ResourceType { return .deviceMetric } + + /// Unique identifier of this DeviceMetric + public var identifier: Identifier + + /// Identity of metric, for example Heart Rate or PEEP Setting + public var type: CodeableConcept + + /// Unit of Measure for the Metric + public var unit: CodeableConcept? + + /// Describes the link to the source Device + public var source: Reference? + + /// Describes the link to the parent DeviceComponent + public var parent: Reference? + + /// Indicates current operational state of the device. For example: On, Off, Standby, etc. + public var operationalStatus: FHIRPrimitive? + + /// Describes the color representation for the metric. This is often used to aid clinicians to track and identify + /// parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the + /// parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- + /// magenta. + public var color: FHIRPrimitive? + + /// Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, + /// measurement, or calculation. + public var category: FHIRPrimitive + + /// Describes the measurement repetition time + public var measurementPeriod: Timing? + + /// Describes the calibrations that have been performed or that are required to be performed + public var calibration: [DeviceMetricCalibration]? + + /// Designated initializer taking all required properties + public init(category: FHIRPrimitive, identifier: Identifier, type: CodeableConcept) { + self.category = category + self.identifier = identifier + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + calibration: [DeviceMetricCalibration]? = nil, + category: FHIRPrimitive, + color: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + measurementPeriod: Timing? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + operationalStatus: FHIRPrimitive? = nil, + parent: Reference? = nil, + source: Reference? = nil, + text: Narrative? = nil, + type: CodeableConcept, + unit: CodeableConcept? = nil) + { + self.init(category: category, identifier: identifier, type: type) + self.calibration = calibration + self.color = color + self.contained = contained + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.language = language + self.measurementPeriod = measurementPeriod + self.meta = meta + self.modifierExtension = modifierExtension + self.operationalStatus = operationalStatus + self.parent = parent + self.source = source + self.text = text + self.unit = unit + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case calibration + case category; case _category + case color; case _color + case identifier + case measurementPeriod + case operationalStatus; case _operationalStatus + case parent + case source + case type + case unit + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.calibration = try [DeviceMetricCalibration](from: _container, forKeyIfPresent: .calibration) + self.category = try FHIRPrimitive(from: _container, forKey: .category, auxiliaryKey: ._category) + self.color = try FHIRPrimitive(from: _container, forKeyIfPresent: .color, auxiliaryKey: ._color) + self.identifier = try Identifier(from: _container, forKey: .identifier) + self.measurementPeriod = try Timing(from: _container, forKeyIfPresent: .measurementPeriod) + self.operationalStatus = try FHIRPrimitive(from: _container, forKeyIfPresent: .operationalStatus, auxiliaryKey: ._operationalStatus) + self.parent = try Reference(from: _container, forKeyIfPresent: .parent) + self.source = try Reference(from: _container, forKeyIfPresent: .source) + self.type = try CodeableConcept(from: _container, forKey: .type) + self.unit = try CodeableConcept(from: _container, forKeyIfPresent: .unit) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try calibration?.encode(on: &_container, forKey: .calibration) + try category.encode(on: &_container, forKey: .category, auxiliaryKey: ._category) + try color?.encode(on: &_container, forKey: .color, auxiliaryKey: ._color) + try identifier.encode(on: &_container, forKey: .identifier) + try measurementPeriod?.encode(on: &_container, forKey: .measurementPeriod) + try operationalStatus?.encode(on: &_container, forKey: .operationalStatus, auxiliaryKey: ._operationalStatus) + try parent?.encode(on: &_container, forKey: .parent) + try source?.encode(on: &_container, forKey: .source) + try type.encode(on: &_container, forKey: .type) + try unit?.encode(on: &_container, forKey: .unit) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DeviceMetric else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return calibration == _other.calibration + && category == _other.category + && color == _other.color + && identifier == _other.identifier + && measurementPeriod == _other.measurementPeriod + && operationalStatus == _other.operationalStatus + && parent == _other.parent + && source == _other.source + && type == _other.type + && unit == _other.unit + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(calibration) + hasher.combine(category) + hasher.combine(color) + hasher.combine(identifier) + hasher.combine(measurementPeriod) + hasher.combine(operationalStatus) + hasher.combine(parent) + hasher.combine(source) + hasher.combine(type) + hasher.combine(unit) + } +} + +/** + Describes the calibrations that have been performed or that are required to be performed. + */ +open class DeviceMetricCalibration: BackboneElement { + + /// Describes the type of the calibration method. + public var type: FHIRPrimitive? + + /// Describes the state of the calibration. + public var state: FHIRPrimitive? + + /// Describes the time last calibration has been performed + public var time: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + state: FHIRPrimitive? = nil, + time: FHIRPrimitive? = nil, + type: FHIRPrimitive? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.state = state + self.time = time + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case state; case _state + case time; case _time + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.state = try FHIRPrimitive(from: _container, forKeyIfPresent: .state, auxiliaryKey: ._state) + self.time = try FHIRPrimitive(from: _container, forKeyIfPresent: .time, auxiliaryKey: ._time) + self.type = try FHIRPrimitive(from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try state?.encode(on: &_container, forKey: .state, auxiliaryKey: ._state) + try time?.encode(on: &_container, forKey: .time, auxiliaryKey: ._time) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DeviceMetricCalibration else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return state == _other.state + && time == _other.time + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(state) + hasher.combine(time) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/DeviceRequest.swift b/Sources/ModelsSTU3/DeviceRequest.swift new file mode 100644 index 0000000..6efc6c4 --- /dev/null +++ b/Sources/ModelsSTU3/DeviceRequest.swift @@ -0,0 +1,456 @@ +// +// DeviceRequest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DeviceRequest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Medical device request. + + Represents a request for a patient to employ a medical device. The device may be an implantable device, or an external + assistive device, such as a walker. + */ +open class DeviceRequest: DomainResource { + + override open class var resourceType: ResourceType { return .deviceRequest } + + /// All possible types for "code[x]" + public enum CodeX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// All possible types for "occurrence[x]" + public enum OccurrenceX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + case timing(Timing) + } + + /// External Request identifier + public var identifier: [Identifier]? + + /// Protocol or definition + public var definition: [Reference]? + + /// What request fulfills + public var basedOn: [Reference]? + + /// What request replaces + public var priorRequest: [Reference]? + + /// Identifier of composite request + public var groupIdentifier: Identifier? + + /// The status of the request. + public var status: FHIRPrimitive? + + /// proposal | plan | original-order | encoded | reflex-order + public var intent: CodeableConcept + + /// None + public var priority: FHIRPrimitive? + + /// Device requested + /// One of `code[x]` + public var code: CodeX + + /// Focus of request + public var subject: Reference + + /// Encounter or Episode motivating request + public var context: Reference? + + /// Desired time or schedule for use + /// One of `occurrence[x]` + public var occurrence: OccurrenceX? + + /// When recorded + public var authoredOn: FHIRPrimitive? + + /// Who/what is requesting diagnostics + public var requester: DeviceRequestRequester? + + /// Fille role + public var performerType: CodeableConcept? + + /// Requested Filler + public var performer: Reference? + + /// Coded Reason for request + public var reasonCode: [CodeableConcept]? + + /// Linked Reason for request + public var reasonReference: [Reference]? + + /// Additional clinical information + public var supportingInfo: [Reference]? + + /// Notes or comments + public var note: [Annotation]? + + /// Request provenance + public var relevantHistory: [Reference]? + + /// Designated initializer taking all required properties + public init(code: CodeX, intent: CodeableConcept, subject: Reference) { + self.code = code + self.intent = intent + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + authoredOn: FHIRPrimitive? = nil, + basedOn: [Reference]? = nil, + code: CodeX, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: [Reference]? = nil, + `extension`: [Extension]? = nil, + groupIdentifier: Identifier? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + intent: CodeableConcept, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + occurrence: OccurrenceX? = nil, + performer: Reference? = nil, + performerType: CodeableConcept? = nil, + priorRequest: [Reference]? = nil, + priority: FHIRPrimitive? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + relevantHistory: [Reference]? = nil, + requester: DeviceRequestRequester? = nil, + status: FHIRPrimitive? = nil, + subject: Reference, + supportingInfo: [Reference]? = nil, + text: Narrative? = nil) + { + self.init(code: code, intent: intent, subject: subject) + self.authoredOn = authoredOn + self.basedOn = basedOn + self.contained = contained + self.context = context + self.definition = definition + self.`extension` = `extension` + self.groupIdentifier = groupIdentifier + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.occurrence = occurrence + self.performer = performer + self.performerType = performerType + self.priorRequest = priorRequest + self.priority = priority + self.reasonCode = reasonCode + self.reasonReference = reasonReference + self.relevantHistory = relevantHistory + self.requester = requester + self.status = status + self.supportingInfo = supportingInfo + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authoredOn; case _authoredOn + case basedOn + case codeCodeableConcept + case codeReference + case context + case definition + case groupIdentifier + case identifier + case intent + case note + case occurrenceDateTime; case _occurrenceDateTime + case occurrencePeriod + case occurrenceTiming + case performer + case performerType + case priorRequest + case priority; case _priority + case reasonCode + case reasonReference + case relevantHistory + case requester + case status; case _status + case subject + case supportingInfo + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.codeCodeableConcept) || _container.contains(CodingKeys.codeReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.codeCodeableConcept, CodingKeys.codeReference], debugDescription: "Must have at least one value for \"code\" but have none")) + } + + // Decode all our properties + self.authoredOn = try FHIRPrimitive(from: _container, forKeyIfPresent: .authoredOn, auxiliaryKey: ._authoredOn) + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + var _t_code: CodeX? = nil + if let codeReference = try Reference(from: _container, forKeyIfPresent: .codeReference) { + if _t_code != nil { + throw DecodingError.dataCorruptedError(forKey: .codeReference, in: _container, debugDescription: "More than one value provided for \"code\"") + } + _t_code = .reference(codeReference) + } + if let codeCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .codeCodeableConcept) { + if _t_code != nil { + throw DecodingError.dataCorruptedError(forKey: .codeCodeableConcept, in: _container, debugDescription: "More than one value provided for \"code\"") + } + _t_code = .codeableConcept(codeCodeableConcept) + } + self.code = _t_code! + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.definition = try [Reference](from: _container, forKeyIfPresent: .definition) + self.groupIdentifier = try Identifier(from: _container, forKeyIfPresent: .groupIdentifier) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.intent = try CodeableConcept(from: _container, forKey: .intent) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + var _t_occurrence: OccurrenceX? = nil + if let occurrenceDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceDateTime, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .dateTime(occurrenceDateTime) + } + if let occurrencePeriod = try Period(from: _container, forKeyIfPresent: .occurrencePeriod) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrencePeriod, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .period(occurrencePeriod) + } + if let occurrenceTiming = try Timing(from: _container, forKeyIfPresent: .occurrenceTiming) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceTiming, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .timing(occurrenceTiming) + } + self.occurrence = _t_occurrence + self.performer = try Reference(from: _container, forKeyIfPresent: .performer) + self.performerType = try CodeableConcept(from: _container, forKeyIfPresent: .performerType) + self.priorRequest = try [Reference](from: _container, forKeyIfPresent: .priorRequest) + self.priority = try FHIRPrimitive(from: _container, forKeyIfPresent: .priority, auxiliaryKey: ._priority) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.relevantHistory = try [Reference](from: _container, forKeyIfPresent: .relevantHistory) + self.requester = try DeviceRequestRequester(from: _container, forKeyIfPresent: .requester) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.supportingInfo = try [Reference](from: _container, forKeyIfPresent: .supportingInfo) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authoredOn?.encode(on: &_container, forKey: .authoredOn, auxiliaryKey: ._authoredOn) + try basedOn?.encode(on: &_container, forKey: .basedOn) + + switch code { + case .reference(let _value): + try _value.encode(on: &_container, forKey: .codeReference) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .codeCodeableConcept) + } + + try context?.encode(on: &_container, forKey: .context) + try definition?.encode(on: &_container, forKey: .definition) + try groupIdentifier?.encode(on: &_container, forKey: .groupIdentifier) + try identifier?.encode(on: &_container, forKey: .identifier) + try intent.encode(on: &_container, forKey: .intent) + try note?.encode(on: &_container, forKey: .note) + if let _enum = occurrence { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .occurrencePeriod) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .occurrenceTiming) + } + } + try performer?.encode(on: &_container, forKey: .performer) + try performerType?.encode(on: &_container, forKey: .performerType) + try priorRequest?.encode(on: &_container, forKey: .priorRequest) + try priority?.encode(on: &_container, forKey: .priority, auxiliaryKey: ._priority) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try relevantHistory?.encode(on: &_container, forKey: .relevantHistory) + try requester?.encode(on: &_container, forKey: .requester) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try supportingInfo?.encode(on: &_container, forKey: .supportingInfo) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DeviceRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authoredOn == _other.authoredOn + && basedOn == _other.basedOn + && code == _other.code + && context == _other.context + && definition == _other.definition + && groupIdentifier == _other.groupIdentifier + && identifier == _other.identifier + && intent == _other.intent + && note == _other.note + && occurrence == _other.occurrence + && performer == _other.performer + && performerType == _other.performerType + && priorRequest == _other.priorRequest + && priority == _other.priority + && reasonCode == _other.reasonCode + && reasonReference == _other.reasonReference + && relevantHistory == _other.relevantHistory + && requester == _other.requester + && status == _other.status + && subject == _other.subject + && supportingInfo == _other.supportingInfo + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authoredOn) + hasher.combine(basedOn) + hasher.combine(code) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(groupIdentifier) + hasher.combine(identifier) + hasher.combine(intent) + hasher.combine(note) + hasher.combine(occurrence) + hasher.combine(performer) + hasher.combine(performerType) + hasher.combine(priorRequest) + hasher.combine(priority) + hasher.combine(reasonCode) + hasher.combine(reasonReference) + hasher.combine(relevantHistory) + hasher.combine(requester) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(supportingInfo) + } +} + +/** + Who/what is requesting diagnostics. + + The individual who initiated the request and has responsibility for its activation. + */ +open class DeviceRequestRequester: BackboneElement { + + /// Individual making the request + public var agent: Reference + + /// Organization agent is acting for + public var onBehalfOf: Reference? + + /// Designated initializer taking all required properties + public init(agent: Reference) { + self.agent = agent + super.init() + } + + /// Convenience initializer + public convenience init( + agent: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil) + { + self.init(agent: agent) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case agent + case onBehalfOf + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.agent = try Reference(from: _container, forKey: .agent) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try agent.encode(on: &_container, forKey: .agent) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DeviceRequestRequester else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return agent == _other.agent + && onBehalfOf == _other.onBehalfOf + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(agent) + hasher.combine(onBehalfOf) + } +} diff --git a/Sources/ModelsSTU3/DeviceUseStatement.swift b/Sources/ModelsSTU3/DeviceUseStatement.swift new file mode 100644 index 0000000..9920707 --- /dev/null +++ b/Sources/ModelsSTU3/DeviceUseStatement.swift @@ -0,0 +1,243 @@ +// +// DeviceUseStatement.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Record of use of a device. + + A record of a device being used by a patient where the record is the result of a report from the patient or another + clinician. + */ +open class DeviceUseStatement: DomainResource { + + override open class var resourceType: ResourceType { return .deviceUseStatement } + + /// All possible types for "timing[x]" + public enum TimingX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + case timing(Timing) + } + + /// External identifier for this record + public var identifier: [Identifier]? + + /// A code representing the patient or other source's judgment about the state of the device used that this + /// statement is about. Generally this will be active or completed. + public var status: FHIRPrimitive + + /// Patient using device + public var subject: Reference + + /// Period device was used + public var whenUsed: Period? + + /// How often the device was used + /// One of `timing[x]` + public var timing: TimingX? + + /// When statement was recorded + public var recordedOn: FHIRPrimitive? + + /// Who made the statement + public var source: Reference? + + /// Reference to device used + public var device: Reference + + /// Why device was used + public var indication: [CodeableConcept]? + + /// Target body site + public var bodySite: CodeableConcept? + + /// Addition details (comments, instructions) + public var note: [Annotation]? + + /// Designated initializer taking all required properties + public init(device: Reference, status: FHIRPrimitive, subject: Reference) { + self.device = device + self.status = status + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + bodySite: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + device: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + indication: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + recordedOn: FHIRPrimitive? = nil, + source: Reference? = nil, + status: FHIRPrimitive, + subject: Reference, + text: Narrative? = nil, + timing: TimingX? = nil, + whenUsed: Period? = nil) + { + self.init(device: device, status: status, subject: subject) + self.bodySite = bodySite + self.contained = contained + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.indication = indication + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.recordedOn = recordedOn + self.source = source + self.text = text + self.timing = timing + self.whenUsed = whenUsed + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case bodySite + case device + case identifier + case indication + case note + case recordedOn; case _recordedOn + case source + case status; case _status + case subject + case timingDateTime; case _timingDateTime + case timingPeriod + case timingTiming + case whenUsed + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.bodySite = try CodeableConcept(from: _container, forKeyIfPresent: .bodySite) + self.device = try Reference(from: _container, forKey: .device) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.indication = try [CodeableConcept](from: _container, forKeyIfPresent: .indication) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.recordedOn = try FHIRPrimitive(from: _container, forKeyIfPresent: .recordedOn, auxiliaryKey: ._recordedOn) + self.source = try Reference(from: _container, forKeyIfPresent: .source) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + var _t_timing: TimingX? = nil + if let timingTiming = try Timing(from: _container, forKeyIfPresent: .timingTiming) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingTiming, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .timing(timingTiming) + } + if let timingPeriod = try Period(from: _container, forKeyIfPresent: .timingPeriod) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingPeriod, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .period(timingPeriod) + } + if let timingDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .timingDateTime, auxiliaryKey: ._timingDateTime) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingDateTime, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .dateTime(timingDateTime) + } + self.timing = _t_timing + self.whenUsed = try Period(from: _container, forKeyIfPresent: .whenUsed) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try bodySite?.encode(on: &_container, forKey: .bodySite) + try device.encode(on: &_container, forKey: .device) + try identifier?.encode(on: &_container, forKey: .identifier) + try indication?.encode(on: &_container, forKey: .indication) + try note?.encode(on: &_container, forKey: .note) + try recordedOn?.encode(on: &_container, forKey: .recordedOn, auxiliaryKey: ._recordedOn) + try source?.encode(on: &_container, forKey: .source) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + if let _enum = timing { + switch _enum { + case .timing(let _value): + try _value.encode(on: &_container, forKey: .timingTiming) + case .period(let _value): + try _value.encode(on: &_container, forKey: .timingPeriod) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .timingDateTime, auxiliaryKey: ._timingDateTime) + } + } + try whenUsed?.encode(on: &_container, forKey: .whenUsed) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DeviceUseStatement else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return bodySite == _other.bodySite + && device == _other.device + && identifier == _other.identifier + && indication == _other.indication + && note == _other.note + && recordedOn == _other.recordedOn + && source == _other.source + && status == _other.status + && subject == _other.subject + && timing == _other.timing + && whenUsed == _other.whenUsed + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(bodySite) + hasher.combine(device) + hasher.combine(identifier) + hasher.combine(indication) + hasher.combine(note) + hasher.combine(recordedOn) + hasher.combine(source) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(timing) + hasher.combine(whenUsed) + } +} diff --git a/Sources/ModelsSTU3/DiagnosticReport.swift b/Sources/ModelsSTU3/DiagnosticReport.swift new file mode 100644 index 0000000..df9bbcf --- /dev/null +++ b/Sources/ModelsSTU3/DiagnosticReport.swift @@ -0,0 +1,458 @@ +// +// DiagnosticReport.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A Diagnostic report - a combination of request information, atomic results, images, interpretation, as well as + formatted reports. + + The findings and interpretation of diagnostic tests performed on patients, groups of patients, devices, and locations, + and/or specimens derived from these. The report includes clinical context such as requesting and provider information, + and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic + reports. + */ +open class DiagnosticReport: DomainResource { + + override open class var resourceType: ResourceType { return .diagnosticReport } + + /// All possible types for "effective[x]" + public enum EffectiveX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// Business identifier for report + public var identifier: [Identifier]? + + /// What was requested + public var basedOn: [Reference]? + + /// The status of the diagnostic report as a whole. + public var status: FHIRPrimitive + + /// Service category + public var category: CodeableConcept? + + /// Name/Code for this diagnostic report + public var code: CodeableConcept + + /// The subject of the report - usually, but not always, the patient + public var subject: Reference? + + /// Health care event when test ordered + public var context: Reference? + + /// Clinically relevant time/time-period for report + /// One of `effective[x]` + public var effective: EffectiveX? + + /// DateTime this version was released + public var issued: FHIRPrimitive? + + /// Participants in producing the report + public var performer: [DiagnosticReportPerformer]? + + /// Specimens this report is based on + public var specimen: [Reference]? + + /// Observations - simple, or complex nested groups + public var result: [Reference]? + + /// Reference to full details of imaging associated with the diagnostic report + public var imagingStudy: [Reference]? + + /// Key images associated with this report + public var image: [DiagnosticReportImage]? + + /// Clinical Interpretation of test results + public var conclusion: FHIRPrimitive? + + /// Codes for the conclusion + public var codedDiagnosis: [CodeableConcept]? + + /// Entire report as issued + public var presentedForm: [Attachment]? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept, status: FHIRPrimitive) { + self.code = code + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + basedOn: [Reference]? = nil, + category: CodeableConcept? = nil, + code: CodeableConcept, + codedDiagnosis: [CodeableConcept]? = nil, + conclusion: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + effective: EffectiveX? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + image: [DiagnosticReportImage]? = nil, + imagingStudy: [Reference]? = nil, + implicitRules: FHIRPrimitive? = nil, + issued: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + performer: [DiagnosticReportPerformer]? = nil, + presentedForm: [Attachment]? = nil, + result: [Reference]? = nil, + specimen: [Reference]? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil) + { + self.init(code: code, status: status) + self.basedOn = basedOn + self.category = category + self.codedDiagnosis = codedDiagnosis + self.conclusion = conclusion + self.contained = contained + self.context = context + self.effective = effective + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.image = image + self.imagingStudy = imagingStudy + self.implicitRules = implicitRules + self.issued = issued + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.performer = performer + self.presentedForm = presentedForm + self.result = result + self.specimen = specimen + self.subject = subject + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case basedOn + case category + case code + case codedDiagnosis + case conclusion; case _conclusion + case context + case effectiveDateTime; case _effectiveDateTime + case effectivePeriod + case identifier + case image + case imagingStudy + case issued; case _issued + case performer + case presentedForm + case result + case specimen + case status; case _status + case subject + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.code = try CodeableConcept(from: _container, forKey: .code) + self.codedDiagnosis = try [CodeableConcept](from: _container, forKeyIfPresent: .codedDiagnosis) + self.conclusion = try FHIRPrimitive(from: _container, forKeyIfPresent: .conclusion, auxiliaryKey: ._conclusion) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + var _t_effective: EffectiveX? = nil + if let effectiveDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .effectiveDateTime, auxiliaryKey: ._effectiveDateTime) { + if _t_effective != nil { + throw DecodingError.dataCorruptedError(forKey: .effectiveDateTime, in: _container, debugDescription: "More than one value provided for \"effective\"") + } + _t_effective = .dateTime(effectiveDateTime) + } + if let effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) { + if _t_effective != nil { + throw DecodingError.dataCorruptedError(forKey: .effectivePeriod, in: _container, debugDescription: "More than one value provided for \"effective\"") + } + _t_effective = .period(effectivePeriod) + } + self.effective = _t_effective + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.image = try [DiagnosticReportImage](from: _container, forKeyIfPresent: .image) + self.imagingStudy = try [Reference](from: _container, forKeyIfPresent: .imagingStudy) + self.issued = try FHIRPrimitive(from: _container, forKeyIfPresent: .issued, auxiliaryKey: ._issued) + self.performer = try [DiagnosticReportPerformer](from: _container, forKeyIfPresent: .performer) + self.presentedForm = try [Attachment](from: _container, forKeyIfPresent: .presentedForm) + self.result = try [Reference](from: _container, forKeyIfPresent: .result) + self.specimen = try [Reference](from: _container, forKeyIfPresent: .specimen) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try basedOn?.encode(on: &_container, forKey: .basedOn) + try category?.encode(on: &_container, forKey: .category) + try code.encode(on: &_container, forKey: .code) + try codedDiagnosis?.encode(on: &_container, forKey: .codedDiagnosis) + try conclusion?.encode(on: &_container, forKey: .conclusion, auxiliaryKey: ._conclusion) + try context?.encode(on: &_container, forKey: .context) + if let _enum = effective { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .effectiveDateTime, auxiliaryKey: ._effectiveDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .effectivePeriod) + } + } + try identifier?.encode(on: &_container, forKey: .identifier) + try image?.encode(on: &_container, forKey: .image) + try imagingStudy?.encode(on: &_container, forKey: .imagingStudy) + try issued?.encode(on: &_container, forKey: .issued, auxiliaryKey: ._issued) + try performer?.encode(on: &_container, forKey: .performer) + try presentedForm?.encode(on: &_container, forKey: .presentedForm) + try result?.encode(on: &_container, forKey: .result) + try specimen?.encode(on: &_container, forKey: .specimen) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DiagnosticReport else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return basedOn == _other.basedOn + && category == _other.category + && code == _other.code + && codedDiagnosis == _other.codedDiagnosis + && conclusion == _other.conclusion + && context == _other.context + && effective == _other.effective + && identifier == _other.identifier + && image == _other.image + && imagingStudy == _other.imagingStudy + && issued == _other.issued + && performer == _other.performer + && presentedForm == _other.presentedForm + && result == _other.result + && specimen == _other.specimen + && status == _other.status + && subject == _other.subject + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(basedOn) + hasher.combine(category) + hasher.combine(code) + hasher.combine(codedDiagnosis) + hasher.combine(conclusion) + hasher.combine(context) + hasher.combine(effective) + hasher.combine(identifier) + hasher.combine(image) + hasher.combine(imagingStudy) + hasher.combine(issued) + hasher.combine(performer) + hasher.combine(presentedForm) + hasher.combine(result) + hasher.combine(specimen) + hasher.combine(status) + hasher.combine(subject) + } +} + +/** + Key images associated with this report. + + A list of key images associated with this report. The images are generally created during the diagnostic process, and + may be directly of the patient, or of treated specimens (i.e. slides of interest). + */ +open class DiagnosticReportImage: BackboneElement { + + /// Comment about the image (e.g. explanation) + public var comment: FHIRPrimitive? + + /// Reference to the image source + public var link: Reference + + /// Designated initializer taking all required properties + public init(link: Reference) { + self.link = link + super.init() + } + + /// Convenience initializer + public convenience init( + comment: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + link: Reference, + modifierExtension: [Extension]? = nil) + { + self.init(link: link) + self.comment = comment + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case comment; case _comment + case link + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.link = try Reference(from: _container, forKey: .link) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try link.encode(on: &_container, forKey: .link) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DiagnosticReportImage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return comment == _other.comment + && link == _other.link + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(comment) + hasher.combine(link) + } +} + +/** + Participants in producing the report. + + Indicates who or what participated in producing the report. + */ +open class DiagnosticReportPerformer: BackboneElement { + + /// Type of performer + public var role: CodeableConcept? + + /// Practitioner or Organization participant + public var actor: Reference + + /// Designated initializer taking all required properties + public init(actor: Reference) { + self.actor = actor + super.init() + } + + /// Convenience initializer + public convenience init( + actor: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + role: CodeableConcept? = nil) + { + self.init(actor: actor) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actor + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actor = try Reference(from: _container, forKey: .actor) + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actor.encode(on: &_container, forKey: .actor) + try role?.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DiagnosticReportPerformer else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actor == _other.actor + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actor) + hasher.combine(role) + } +} diff --git a/Sources/ModelsSTU3/Distance.swift b/Sources/ModelsSTU3/Distance.swift new file mode 100644 index 0000000..e1eef74 --- /dev/null +++ b/Sources/ModelsSTU3/Distance.swift @@ -0,0 +1,79 @@ +// +// Distance.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Distance) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A length - a value with a unit that is a physical distance. + */ +open class Distance: Quantity { + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive? = nil, + comparator: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + system: FHIRPrimitive? = nil, + unit: FHIRPrimitive? = nil, + value: FHIRPrimitive? = nil) + { + self.init() + self.code = code + self.comparator = comparator + self.`extension` = `extension` + self.id = id + self.system = system + self.unit = unit + self.value = value + } + + // MARK: - Codable + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Distance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return true + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + } +} diff --git a/Sources/ModelsSTU3/DocumentManifest.swift b/Sources/ModelsSTU3/DocumentManifest.swift new file mode 100644 index 0000000..cbb7962 --- /dev/null +++ b/Sources/ModelsSTU3/DocumentManifest.swift @@ -0,0 +1,398 @@ +// +// DocumentManifest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DocumentManifest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A list that defines a set of documents. + + A collection of documents compiled for a purpose together with metadata that applies to the collection. + */ +open class DocumentManifest: DomainResource { + + override open class var resourceType: ResourceType { return .documentManifest } + + /// Unique Identifier for the set of documents + public var masterIdentifier: Identifier? + + /// Other identifiers for the manifest + public var identifier: [Identifier]? + + /// The status of this document manifest. + public var status: FHIRPrimitive + + /// Kind of document set + public var type: CodeableConcept? + + /// The subject of the set of documents + public var subject: Reference? + + /// When this document manifest created + public var created: FHIRPrimitive? + + /// Who and/or what authored the manifest + public var author: [Reference]? + + /// Intended to get notified about this set of documents + public var recipient: [Reference]? + + /// The source system/application/software + public var source: FHIRPrimitive? + + /// Human-readable description (title) + public var description_fhir: FHIRPrimitive? + + /// The items included + public var content: [DocumentManifestContent] + + /// Related things + public var related: [DocumentManifestRelated]? + + /// Designated initializer taking all required properties + public init(content: [DocumentManifestContent], status: FHIRPrimitive) { + self.content = content + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + author: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + content: [DocumentManifestContent], + created: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + masterIdentifier: Identifier? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + recipient: [Reference]? = nil, + related: [DocumentManifestRelated]? = nil, + source: FHIRPrimitive? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil, + type: CodeableConcept? = nil) + { + self.init(content: content, status: status) + self.author = author + self.contained = contained + self.created = created + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.masterIdentifier = masterIdentifier + self.meta = meta + self.modifierExtension = modifierExtension + self.recipient = recipient + self.related = related + self.source = source + self.subject = subject + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case author + case content + case created; case _created + case description_fhir = "description"; case _description_fhir = "_description" + case identifier + case masterIdentifier + case recipient + case related + case source; case _source + case status; case _status + case subject + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.author = try [Reference](from: _container, forKeyIfPresent: .author) + self.content = try [DocumentManifestContent](from: _container, forKey: .content) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.masterIdentifier = try Identifier(from: _container, forKeyIfPresent: .masterIdentifier) + self.recipient = try [Reference](from: _container, forKeyIfPresent: .recipient) + self.related = try [DocumentManifestRelated](from: _container, forKeyIfPresent: .related) + self.source = try FHIRPrimitive(from: _container, forKeyIfPresent: .source, auxiliaryKey: ._source) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try author?.encode(on: &_container, forKey: .author) + try content.encode(on: &_container, forKey: .content) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try identifier?.encode(on: &_container, forKey: .identifier) + try masterIdentifier?.encode(on: &_container, forKey: .masterIdentifier) + try recipient?.encode(on: &_container, forKey: .recipient) + try related?.encode(on: &_container, forKey: .related) + try source?.encode(on: &_container, forKey: .source, auxiliaryKey: ._source) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DocumentManifest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return author == _other.author + && content == _other.content + && created == _other.created + && description_fhir == _other.description_fhir + && identifier == _other.identifier + && masterIdentifier == _other.masterIdentifier + && recipient == _other.recipient + && related == _other.related + && source == _other.source + && status == _other.status + && subject == _other.subject + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(author) + hasher.combine(content) + hasher.combine(created) + hasher.combine(description_fhir) + hasher.combine(identifier) + hasher.combine(masterIdentifier) + hasher.combine(recipient) + hasher.combine(related) + hasher.combine(source) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(type) + } +} + +/** + The items included. + + The list of Documents included in the manifest. + */ +open class DocumentManifestContent: BackboneElement { + + /// All possible types for "p[x]" + public enum PX: Hashable { + case attachment(Attachment) + case reference(Reference) + } + + /// Contents of this set of documents + /// One of `p[x]` + public var p: PX + + /// Designated initializer taking all required properties + public init(p: PX) { + self.p = p + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + p: PX) + { + self.init(p: p) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case pAttachment + case pReference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.pAttachment) || _container.contains(CodingKeys.pReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.pAttachment, CodingKeys.pReference], debugDescription: "Must have at least one value for \"p\" but have none")) + } + + // Decode all our properties + var _t_p: PX? = nil + if let pAttachment = try Attachment(from: _container, forKeyIfPresent: .pAttachment) { + if _t_p != nil { + throw DecodingError.dataCorruptedError(forKey: .pAttachment, in: _container, debugDescription: "More than one value provided for \"p\"") + } + _t_p = .attachment(pAttachment) + } + if let pReference = try Reference(from: _container, forKeyIfPresent: .pReference) { + if _t_p != nil { + throw DecodingError.dataCorruptedError(forKey: .pReference, in: _container, debugDescription: "More than one value provided for \"p\"") + } + _t_p = .reference(pReference) + } + self.p = _t_p! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + + switch p { + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .pAttachment) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .pReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DocumentManifestContent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return p == _other.p + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(p) + } +} + +/** + Related things. + + Related identifiers or resources associated with the DocumentManifest. + */ +open class DocumentManifestRelated: BackboneElement { + + /// Identifiers of things that are related + public var identifier: Identifier? + + /// Related Resource + public var ref: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + ref: Reference? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.ref = ref + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case identifier + case ref + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.ref = try Reference(from: _container, forKeyIfPresent: .ref) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try identifier?.encode(on: &_container, forKey: .identifier) + try ref?.encode(on: &_container, forKey: .ref) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DocumentManifestRelated else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return identifier == _other.identifier + && ref == _other.ref + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(identifier) + hasher.combine(ref) + } +} diff --git a/Sources/ModelsSTU3/DocumentReference.swift b/Sources/ModelsSTU3/DocumentReference.swift new file mode 100644 index 0000000..c938e9f --- /dev/null +++ b/Sources/ModelsSTU3/DocumentReference.swift @@ -0,0 +1,635 @@ +// +// DocumentReference.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DocumentReference) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A reference to a document. + */ +open class DocumentReference: DomainResource { + + override open class var resourceType: ResourceType { return .documentReference } + + /// Master Version Specific Identifier + public var masterIdentifier: Identifier? + + /// Other identifiers for the document + public var identifier: [Identifier]? + + /// The status of this document reference. + public var status: FHIRPrimitive + + /// The status of the underlying document. + public var docStatus: FHIRPrimitive? + + /// Kind of document (LOINC if possible) + public var type: CodeableConcept + + /// Categorization of document + public var `class`: CodeableConcept? + + /// Who/what is the subject of the document + public var subject: Reference? + + /// Document creation time + public var created: FHIRPrimitive? + + /// When this document reference was created + public var indexed: FHIRPrimitive + + /// Who and/or what authored the document + public var author: [Reference]? + + /// Who/what authenticated the document + public var authenticator: Reference? + + /// Organization which maintains the document + public var custodian: Reference? + + /// Relationships to other documents + public var relatesTo: [DocumentReferenceRelatesTo]? + + /// Human-readable description (title) + public var description_fhir: FHIRPrimitive? + + /// Document security-tags + public var securityLabel: [CodeableConcept]? + + /// Document referenced + public var content: [DocumentReferenceContent] + + /// Clinical context of document + public var context: DocumentReferenceContext? + + /// Designated initializer taking all required properties + public init(content: [DocumentReferenceContent], indexed: FHIRPrimitive, status: FHIRPrimitive, type: CodeableConcept) { + self.content = content + self.indexed = indexed + self.status = status + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + authenticator: Reference? = nil, + author: [Reference]? = nil, + `class`: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + content: [DocumentReferenceContent], + context: DocumentReferenceContext? = nil, + created: FHIRPrimitive? = nil, + custodian: Reference? = nil, + description_fhir: FHIRPrimitive? = nil, + docStatus: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + indexed: FHIRPrimitive, + language: FHIRPrimitive? = nil, + masterIdentifier: Identifier? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + relatesTo: [DocumentReferenceRelatesTo]? = nil, + securityLabel: [CodeableConcept]? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil, + type: CodeableConcept) + { + self.init(content: content, indexed: indexed, status: status, type: type) + self.authenticator = authenticator + self.author = author + self.`class` = `class` + self.contained = contained + self.context = context + self.created = created + self.custodian = custodian + self.description_fhir = description_fhir + self.docStatus = docStatus + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.masterIdentifier = masterIdentifier + self.meta = meta + self.modifierExtension = modifierExtension + self.relatesTo = relatesTo + self.securityLabel = securityLabel + self.subject = subject + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authenticator + case author + case `class` = "class" + case content + case context + case created; case _created + case custodian + case description_fhir = "description"; case _description_fhir = "_description" + case docStatus; case _docStatus + case identifier + case indexed; case _indexed + case masterIdentifier + case relatesTo + case securityLabel + case status; case _status + case subject + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.authenticator = try Reference(from: _container, forKeyIfPresent: .authenticator) + self.author = try [Reference](from: _container, forKeyIfPresent: .author) + self.`class` = try CodeableConcept(from: _container, forKeyIfPresent: .`class`) + self.content = try [DocumentReferenceContent](from: _container, forKey: .content) + self.context = try DocumentReferenceContext(from: _container, forKeyIfPresent: .context) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.custodian = try Reference(from: _container, forKeyIfPresent: .custodian) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.docStatus = try FHIRPrimitive(from: _container, forKeyIfPresent: .docStatus, auxiliaryKey: ._docStatus) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.indexed = try FHIRPrimitive(from: _container, forKey: .indexed, auxiliaryKey: ._indexed) + self.masterIdentifier = try Identifier(from: _container, forKeyIfPresent: .masterIdentifier) + self.relatesTo = try [DocumentReferenceRelatesTo](from: _container, forKeyIfPresent: .relatesTo) + self.securityLabel = try [CodeableConcept](from: _container, forKeyIfPresent: .securityLabel) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.type = try CodeableConcept(from: _container, forKey: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authenticator?.encode(on: &_container, forKey: .authenticator) + try author?.encode(on: &_container, forKey: .author) + try `class`?.encode(on: &_container, forKey: .`class`) + try content.encode(on: &_container, forKey: .content) + try context?.encode(on: &_container, forKey: .context) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try custodian?.encode(on: &_container, forKey: .custodian) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try docStatus?.encode(on: &_container, forKey: .docStatus, auxiliaryKey: ._docStatus) + try identifier?.encode(on: &_container, forKey: .identifier) + try indexed.encode(on: &_container, forKey: .indexed, auxiliaryKey: ._indexed) + try masterIdentifier?.encode(on: &_container, forKey: .masterIdentifier) + try relatesTo?.encode(on: &_container, forKey: .relatesTo) + try securityLabel?.encode(on: &_container, forKey: .securityLabel) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try type.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DocumentReference else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authenticator == _other.authenticator + && author == _other.author + && `class` == _other.`class` + && content == _other.content + && context == _other.context + && created == _other.created + && custodian == _other.custodian + && description_fhir == _other.description_fhir + && docStatus == _other.docStatus + && identifier == _other.identifier + && indexed == _other.indexed + && masterIdentifier == _other.masterIdentifier + && relatesTo == _other.relatesTo + && securityLabel == _other.securityLabel + && status == _other.status + && subject == _other.subject + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authenticator) + hasher.combine(author) + hasher.combine(`class`) + hasher.combine(content) + hasher.combine(context) + hasher.combine(created) + hasher.combine(custodian) + hasher.combine(description_fhir) + hasher.combine(docStatus) + hasher.combine(identifier) + hasher.combine(indexed) + hasher.combine(masterIdentifier) + hasher.combine(relatesTo) + hasher.combine(securityLabel) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(type) + } +} + +/** + Document referenced. + + The document and format referenced. There may be multiple content element repetitions, each with a different format. + */ +open class DocumentReferenceContent: BackboneElement { + + /// Where to access the document + public var attachment: Attachment + + /// Format/content rules for the document + public var format: Coding? + + /// Designated initializer taking all required properties + public init(attachment: Attachment) { + self.attachment = attachment + super.init() + } + + /// Convenience initializer + public convenience init( + attachment: Attachment, + `extension`: [Extension]? = nil, + format: Coding? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(attachment: attachment) + self.`extension` = `extension` + self.format = format + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case attachment + case format + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.attachment = try Attachment(from: _container, forKey: .attachment) + self.format = try Coding(from: _container, forKeyIfPresent: .format) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try attachment.encode(on: &_container, forKey: .attachment) + try format?.encode(on: &_container, forKey: .format) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DocumentReferenceContent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return attachment == _other.attachment + && format == _other.format + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(attachment) + hasher.combine(format) + } +} + +/** + Clinical context of document. + + The clinical context in which the document was prepared. + */ +open class DocumentReferenceContext: BackboneElement { + + /// Context of the document content + public var encounter: Reference? + + /// Main clinical acts documented + public var event: [CodeableConcept]? + + /// Time of service that is being documented + public var period: Period? + + /// Kind of facility where patient was seen + public var facilityType: CodeableConcept? + + /// Additional details about where the content was created (e.g. clinical specialty) + public var practiceSetting: CodeableConcept? + + /// Patient demographics from source + public var sourcePatientInfo: Reference? + + /// Related identifiers or resources + public var related: [DocumentReferenceContextRelated]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + encounter: Reference? = nil, + event: [CodeableConcept]? = nil, + `extension`: [Extension]? = nil, + facilityType: CodeableConcept? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil, + practiceSetting: CodeableConcept? = nil, + related: [DocumentReferenceContextRelated]? = nil, + sourcePatientInfo: Reference? = nil) + { + self.init() + self.encounter = encounter + self.event = event + self.`extension` = `extension` + self.facilityType = facilityType + self.id = id + self.modifierExtension = modifierExtension + self.period = period + self.practiceSetting = practiceSetting + self.related = related + self.sourcePatientInfo = sourcePatientInfo + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case encounter + case event + case facilityType + case period + case practiceSetting + case related + case sourcePatientInfo + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.encounter = try Reference(from: _container, forKeyIfPresent: .encounter) + self.event = try [CodeableConcept](from: _container, forKeyIfPresent: .event) + self.facilityType = try CodeableConcept(from: _container, forKeyIfPresent: .facilityType) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.practiceSetting = try CodeableConcept(from: _container, forKeyIfPresent: .practiceSetting) + self.related = try [DocumentReferenceContextRelated](from: _container, forKeyIfPresent: .related) + self.sourcePatientInfo = try Reference(from: _container, forKeyIfPresent: .sourcePatientInfo) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try encounter?.encode(on: &_container, forKey: .encounter) + try event?.encode(on: &_container, forKey: .event) + try facilityType?.encode(on: &_container, forKey: .facilityType) + try period?.encode(on: &_container, forKey: .period) + try practiceSetting?.encode(on: &_container, forKey: .practiceSetting) + try related?.encode(on: &_container, forKey: .related) + try sourcePatientInfo?.encode(on: &_container, forKey: .sourcePatientInfo) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DocumentReferenceContext else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return encounter == _other.encounter + && event == _other.event + && facilityType == _other.facilityType + && period == _other.period + && practiceSetting == _other.practiceSetting + && related == _other.related + && sourcePatientInfo == _other.sourcePatientInfo + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(encounter) + hasher.combine(event) + hasher.combine(facilityType) + hasher.combine(period) + hasher.combine(practiceSetting) + hasher.combine(related) + hasher.combine(sourcePatientInfo) + } +} + +/** + Related identifiers or resources. + + Related identifiers or resources associated with the DocumentReference. + */ +open class DocumentReferenceContextRelated: BackboneElement { + + /// Identifier of related objects or events + public var identifier: Identifier? + + /// Related Resource + public var ref: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + ref: Reference? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.ref = ref + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case identifier + case ref + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.ref = try Reference(from: _container, forKeyIfPresent: .ref) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try identifier?.encode(on: &_container, forKey: .identifier) + try ref?.encode(on: &_container, forKey: .ref) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DocumentReferenceContextRelated else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return identifier == _other.identifier + && ref == _other.ref + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(identifier) + hasher.combine(ref) + } +} + +/** + Relationships to other documents. + + Relationships that this document has with other document references that already exist. + */ +open class DocumentReferenceRelatesTo: BackboneElement { + + /// The type of relationship that this document has with anther document. + public var code: FHIRPrimitive + + /// Target of the relationship + public var target: Reference + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, target: Reference) { + self.code = code + self.target = target + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + target: Reference) + { + self.init(code: code, target: target) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.target = try Reference(from: _container, forKey: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try target.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DocumentReferenceRelatesTo else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(target) + } +} diff --git a/Sources/ModelsSTU3/DomainResource.swift b/Sources/ModelsSTU3/DomainResource.swift new file mode 100644 index 0000000..cebe48d --- /dev/null +++ b/Sources/ModelsSTU3/DomainResource.swift @@ -0,0 +1,125 @@ +// +// DomainResource.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/DomainResource) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A resource with narrative, extensions, and contained resources. + + A resource that includes narrative, extensions, and contained resources. + */ +open class DomainResource: Resource { + + override open class var resourceType: ResourceType { return .domainResource } + + /// Text summary of the resource, for human interpretation + public var text: Narrative? + + /// Contained, inline Resources + public var contained: [ResourceProxy]? + + /// Additional Content defined by implementations + public var `extension`: [Extension]? + + /// Extensions that cannot be ignored + public var modifierExtension: [Extension]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + text: Narrative? = nil) + { + self.init() + self.contained = contained + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contained + case `extension` = "extension" + case modifierExtension + case text + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contained = try [ResourceProxy](from: _container, forKeyIfPresent: .contained) + self.`extension` = try [Extension](from: _container, forKeyIfPresent: .`extension`) + self.modifierExtension = try [Extension](from: _container, forKeyIfPresent: .modifierExtension) + self.text = try Narrative(from: _container, forKeyIfPresent: .text) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contained?.encode(on: &_container, forKey: .contained) + try `extension`?.encode(on: &_container, forKey: .`extension`) + try modifierExtension?.encode(on: &_container, forKey: .modifierExtension) + try text?.encode(on: &_container, forKey: .text) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? DomainResource else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contained == _other.contained + && `extension` == _other.`extension` + && modifierExtension == _other.modifierExtension + && text == _other.text + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contained) + hasher.combine(`extension`) + hasher.combine(modifierExtension) + hasher.combine(text) + } +} diff --git a/Sources/ModelsSTU3/Dosage.swift b/Sources/ModelsSTU3/Dosage.swift new file mode 100644 index 0000000..ab6ca3f --- /dev/null +++ b/Sources/ModelsSTU3/Dosage.swift @@ -0,0 +1,313 @@ +// +// Dosage.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Dosage) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + How the medication is/was taken or should be taken. + + Indicates how the medication is/was taken or should be taken by the patient. + */ +open class Dosage: Element { + + /// All possible types for "asNeeded[x]" + public enum AsNeededX: Hashable { + case boolean(FHIRPrimitive) + case codeableConcept(CodeableConcept) + } + + /// All possible types for "dose[x]" + public enum DoseX: Hashable { + case quantity(Quantity) + case range(Range) + } + + /// All possible types for "rate[x]" + public enum RateX: Hashable { + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + } + + /// The order of the dosage instructions + public var sequence: FHIRPrimitive? + + /// Free text dosage instructions e.g. SIG + public var text: FHIRPrimitive? + + /// Supplemental instruction - e.g. "with meals" + public var additionalInstruction: [CodeableConcept]? + + /// Patient or consumer oriented instructions + public var patientInstruction: FHIRPrimitive? + + /// When medication should be administered + public var timing: Timing? + + /// Take "as needed" (for x) + /// One of `asNeeded[x]` + public var asNeeded: AsNeededX? + + /// Body site to administer to + public var site: CodeableConcept? + + /// How drug should enter body + public var route: CodeableConcept? + + /// Technique for administering medication + public var method: CodeableConcept? + + /// Amount of medication per dose + /// One of `dose[x]` + public var dose: DoseX? + + /// Upper limit on medication per unit of time + public var maxDosePerPeriod: Ratio? + + /// Upper limit on medication per administration + public var maxDosePerAdministration: Quantity? + + /// Upper limit on medication per lifetime of the patient + public var maxDosePerLifetime: Quantity? + + /// Amount of medication per unit of time + /// One of `rate[x]` + public var rate: RateX? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + additionalInstruction: [CodeableConcept]? = nil, + asNeeded: AsNeededX? = nil, + dose: DoseX? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + maxDosePerAdministration: Quantity? = nil, + maxDosePerLifetime: Quantity? = nil, + maxDosePerPeriod: Ratio? = nil, + method: CodeableConcept? = nil, + patientInstruction: FHIRPrimitive? = nil, + rate: RateX? = nil, + route: CodeableConcept? = nil, + sequence: FHIRPrimitive? = nil, + site: CodeableConcept? = nil, + text: FHIRPrimitive? = nil, + timing: Timing? = nil) + { + self.init() + self.additionalInstruction = additionalInstruction + self.asNeeded = asNeeded + self.dose = dose + self.`extension` = `extension` + self.id = id + self.maxDosePerAdministration = maxDosePerAdministration + self.maxDosePerLifetime = maxDosePerLifetime + self.maxDosePerPeriod = maxDosePerPeriod + self.method = method + self.patientInstruction = patientInstruction + self.rate = rate + self.route = route + self.sequence = sequence + self.site = site + self.text = text + self.timing = timing + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case additionalInstruction + case asNeededBoolean; case _asNeededBoolean + case asNeededCodeableConcept + case doseQuantity + case doseRange + case maxDosePerAdministration + case maxDosePerLifetime + case maxDosePerPeriod + case method + case patientInstruction; case _patientInstruction + case rateQuantity + case rateRange + case rateRatio + case route + case sequence; case _sequence + case site + case text; case _text + case timing + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.additionalInstruction = try [CodeableConcept](from: _container, forKeyIfPresent: .additionalInstruction) + var _t_asNeeded: AsNeededX? = nil + if let asNeededBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .asNeededBoolean, auxiliaryKey: ._asNeededBoolean) { + if _t_asNeeded != nil { + throw DecodingError.dataCorruptedError(forKey: .asNeededBoolean, in: _container, debugDescription: "More than one value provided for \"asNeeded\"") + } + _t_asNeeded = .boolean(asNeededBoolean) + } + if let asNeededCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .asNeededCodeableConcept) { + if _t_asNeeded != nil { + throw DecodingError.dataCorruptedError(forKey: .asNeededCodeableConcept, in: _container, debugDescription: "More than one value provided for \"asNeeded\"") + } + _t_asNeeded = .codeableConcept(asNeededCodeableConcept) + } + self.asNeeded = _t_asNeeded + var _t_dose: DoseX? = nil + if let doseRange = try Range(from: _container, forKeyIfPresent: .doseRange) { + if _t_dose != nil { + throw DecodingError.dataCorruptedError(forKey: .doseRange, in: _container, debugDescription: "More than one value provided for \"dose\"") + } + _t_dose = .range(doseRange) + } + if let doseQuantity = try Quantity(from: _container, forKeyIfPresent: .doseQuantity) { + if _t_dose != nil { + throw DecodingError.dataCorruptedError(forKey: .doseQuantity, in: _container, debugDescription: "More than one value provided for \"dose\"") + } + _t_dose = .quantity(doseQuantity) + } + self.dose = _t_dose + self.maxDosePerAdministration = try Quantity(from: _container, forKeyIfPresent: .maxDosePerAdministration) + self.maxDosePerLifetime = try Quantity(from: _container, forKeyIfPresent: .maxDosePerLifetime) + self.maxDosePerPeriod = try Ratio(from: _container, forKeyIfPresent: .maxDosePerPeriod) + self.method = try CodeableConcept(from: _container, forKeyIfPresent: .method) + self.patientInstruction = try FHIRPrimitive(from: _container, forKeyIfPresent: .patientInstruction, auxiliaryKey: ._patientInstruction) + var _t_rate: RateX? = nil + if let rateRatio = try Ratio(from: _container, forKeyIfPresent: .rateRatio) { + if _t_rate != nil { + throw DecodingError.dataCorruptedError(forKey: .rateRatio, in: _container, debugDescription: "More than one value provided for \"rate\"") + } + _t_rate = .ratio(rateRatio) + } + if let rateRange = try Range(from: _container, forKeyIfPresent: .rateRange) { + if _t_rate != nil { + throw DecodingError.dataCorruptedError(forKey: .rateRange, in: _container, debugDescription: "More than one value provided for \"rate\"") + } + _t_rate = .range(rateRange) + } + if let rateQuantity = try Quantity(from: _container, forKeyIfPresent: .rateQuantity) { + if _t_rate != nil { + throw DecodingError.dataCorruptedError(forKey: .rateQuantity, in: _container, debugDescription: "More than one value provided for \"rate\"") + } + _t_rate = .quantity(rateQuantity) + } + self.rate = _t_rate + self.route = try CodeableConcept(from: _container, forKeyIfPresent: .route) + self.sequence = try FHIRPrimitive(from: _container, forKeyIfPresent: .sequence, auxiliaryKey: ._sequence) + self.site = try CodeableConcept(from: _container, forKeyIfPresent: .site) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + self.timing = try Timing(from: _container, forKeyIfPresent: .timing) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try additionalInstruction?.encode(on: &_container, forKey: .additionalInstruction) + if let _enum = asNeeded { + switch _enum { + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .asNeededBoolean, auxiliaryKey: ._asNeededBoolean) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .asNeededCodeableConcept) + } + } + if let _enum = dose { + switch _enum { + case .range(let _value): + try _value.encode(on: &_container, forKey: .doseRange) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .doseQuantity) + } + } + try maxDosePerAdministration?.encode(on: &_container, forKey: .maxDosePerAdministration) + try maxDosePerLifetime?.encode(on: &_container, forKey: .maxDosePerLifetime) + try maxDosePerPeriod?.encode(on: &_container, forKey: .maxDosePerPeriod) + try method?.encode(on: &_container, forKey: .method) + try patientInstruction?.encode(on: &_container, forKey: .patientInstruction, auxiliaryKey: ._patientInstruction) + if let _enum = rate { + switch _enum { + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .rateRatio) + case .range(let _value): + try _value.encode(on: &_container, forKey: .rateRange) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .rateQuantity) + } + } + try route?.encode(on: &_container, forKey: .route) + try sequence?.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try site?.encode(on: &_container, forKey: .site) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try timing?.encode(on: &_container, forKey: .timing) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Dosage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return additionalInstruction == _other.additionalInstruction + && asNeeded == _other.asNeeded + && dose == _other.dose + && maxDosePerAdministration == _other.maxDosePerAdministration + && maxDosePerLifetime == _other.maxDosePerLifetime + && maxDosePerPeriod == _other.maxDosePerPeriod + && method == _other.method + && patientInstruction == _other.patientInstruction + && rate == _other.rate + && route == _other.route + && sequence == _other.sequence + && site == _other.site + && text == _other.text + && timing == _other.timing + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(additionalInstruction) + hasher.combine(asNeeded) + hasher.combine(dose) + hasher.combine(maxDosePerAdministration) + hasher.combine(maxDosePerLifetime) + hasher.combine(maxDosePerPeriod) + hasher.combine(method) + hasher.combine(patientInstruction) + hasher.combine(rate) + hasher.combine(route) + hasher.combine(sequence) + hasher.combine(site) + hasher.combine(text) + hasher.combine(timing) + } +} diff --git a/Sources/ModelsSTU3/Duration.swift b/Sources/ModelsSTU3/Duration.swift new file mode 100644 index 0000000..df8d607 --- /dev/null +++ b/Sources/ModelsSTU3/Duration.swift @@ -0,0 +1,79 @@ +// +// Duration.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Duration) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A length of time. + */ +open class Duration: Quantity { + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive? = nil, + comparator: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + system: FHIRPrimitive? = nil, + unit: FHIRPrimitive? = nil, + value: FHIRPrimitive? = nil) + { + self.init() + self.code = code + self.comparator = comparator + self.`extension` = `extension` + self.id = id + self.system = system + self.unit = unit + self.value = value + } + + // MARK: - Codable + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Duration else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return true + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + } +} diff --git a/Sources/ModelsSTU3/Element.swift b/Sources/ModelsSTU3/Element.swift new file mode 100644 index 0000000..b299495 --- /dev/null +++ b/Sources/ModelsSTU3/Element.swift @@ -0,0 +1,95 @@ +// +// Element.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Element) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Base for all elements. + + Base definition for all elements in a resource. + */ +open class Element: FHIRType { + + /// xml:id (or equivalent in JSON) + public var id: FHIRPrimitive? + + /// Additional Content defined by implementations + public var `extension`: [Extension]? + + /// Designated initializer taking all required properties + public init() { + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case `extension` = "extension" + case id; case _id + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.`extension` = try [Extension](from: _container, forKeyIfPresent: .`extension`) + self.id = try FHIRPrimitive(from: _container, forKeyIfPresent: .id, auxiliaryKey: ._id) + } + + /// Encodable + public func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try `extension`?.encode(on: &_container, forKey: .`extension`) + try id?.encode(on: &_container, forKey: .id, auxiliaryKey: ._id) + } + + // MARK: - Equatable & Hashable + + public static func ==(l: Element, r: Element) -> Bool { + return l.isEqual(to: r) + } + + public func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Element else { + return false + } + guard type(of: self) == type(of: _other) else { + return false + } + return `extension` == _other.`extension` + && id == _other.id + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(`extension`) + hasher.combine(id) + } +} diff --git a/Sources/ModelsSTU3/ElementDefinition.swift b/Sources/ModelsSTU3/ElementDefinition.swift new file mode 100644 index 0000000..a9af07c --- /dev/null +++ b/Sources/ModelsSTU3/ElementDefinition.swift @@ -0,0 +1,2966 @@ +// +// ElementDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ElementDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Definition of an element in a resource or extension. + + Captures constraints on each element within the resource, profile, or extension. + */ +open class ElementDefinition: Element { + + /// All possible types for "defaultValue[x]" + public enum DefaultValueX: Hashable { + case address(Address) + case age(Age) + case annotation(Annotation) + case attachment(Attachment) + case base64Binary(FHIRPrimitive) + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case coding(Coding) + case contactPoint(ContactPoint) + case count(Count) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case distance(Distance) + case duration(Duration) + case humanName(HumanName) + case id(FHIRPrimitive) + case identifier(Identifier) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case markdown(FHIRPrimitive) + case meta(Meta) + case money(Money) + case oid(FHIRPrimitive) + case period(Period) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case reference(Reference) + case sampledData(SampledData) + case signature(Signature) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case timing(Timing) + case unsignedInt(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// All possible types for "fixed[x]" + public enum FixedX: Hashable { + case address(Address) + case age(Age) + case annotation(Annotation) + case attachment(Attachment) + case base64Binary(FHIRPrimitive) + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case coding(Coding) + case contactPoint(ContactPoint) + case count(Count) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case distance(Distance) + case duration(Duration) + case humanName(HumanName) + case id(FHIRPrimitive) + case identifier(Identifier) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case markdown(FHIRPrimitive) + case meta(Meta) + case money(Money) + case oid(FHIRPrimitive) + case period(Period) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case reference(Reference) + case sampledData(SampledData) + case signature(Signature) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case timing(Timing) + case unsignedInt(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// All possible types for "maxValue[x]" + public enum MaxValueX: Hashable { + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case time(FHIRPrimitive) + case unsignedInt(FHIRPrimitive) + } + + /// All possible types for "minValue[x]" + public enum MinValueX: Hashable { + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case time(FHIRPrimitive) + case unsignedInt(FHIRPrimitive) + } + + /// All possible types for "pattern[x]" + public enum PatternX: Hashable { + case address(Address) + case age(Age) + case annotation(Annotation) + case attachment(Attachment) + case base64Binary(FHIRPrimitive) + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case coding(Coding) + case contactPoint(ContactPoint) + case count(Count) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case distance(Distance) + case duration(Duration) + case humanName(HumanName) + case id(FHIRPrimitive) + case identifier(Identifier) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case markdown(FHIRPrimitive) + case meta(Meta) + case money(Money) + case oid(FHIRPrimitive) + case period(Period) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case reference(Reference) + case sampledData(SampledData) + case signature(Signature) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case timing(Timing) + case unsignedInt(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// Path of the element in the hierarchy of elements + public var path: FHIRPrimitive + + /// Codes that define how this element is represented in instances, when the deviation varies from the normal case. + public var representation: [FHIRPrimitive]? + + /// Name for this particular element (in a set of slices) + public var sliceName: FHIRPrimitive? + + /// Name for element to display with or prompt for element + public var label: FHIRPrimitive? + + /// Corresponding codes in terminologies + public var code: [Coding]? + + /// This element is sliced - slices follow + public var slicing: ElementDefinitionSlicing? + + /// Concise definition for space-constrained presentation + public var short: FHIRPrimitive? + + /// Full formal definition as narrative text + public var definition: FHIRPrimitive? + + /// Comments about the use of this element + public var comment: FHIRPrimitive? + + /// Why this resource has been created + public var requirements: FHIRPrimitive? + + /// Other names + public var alias: [FHIRPrimitive]? + + /// Minimum Cardinality + public var min: FHIRPrimitive? + + /// Maximum Cardinality (a number or *) + public var max: FHIRPrimitive? + + /// Base definition information for tools + public var base: ElementDefinitionBase? + + /// Reference to definition of content for the element + public var contentReference: FHIRPrimitive? + + /// Data type and Profile for this element + public var type: [ElementDefinitionType]? + + /// Specified value if missing from instance + /// One of `defaultValue[x]` + public var defaultValue: DefaultValueX? + + /// Implicit meaning when this element is missing + public var meaningWhenMissing: FHIRPrimitive? + + /// What the order of the elements means + public var orderMeaning: FHIRPrimitive? + + /// Value must be exactly this + /// One of `fixed[x]` + public var fixed: FixedX? + + /// Value must have at least these property values + /// One of `pattern[x]` + public var pattern: PatternX? + + /// Example value (as defined for type) + public var example: [ElementDefinitionExample]? + + /// Minimum Allowed Value (for some types) + /// One of `minValue[x]` + public var minValue: MinValueX? + + /// Maximum Allowed Value (for some types) + /// One of `maxValue[x]` + public var maxValue: MaxValueX? + + /// Max length for strings + public var maxLength: FHIRPrimitive? + + /// Reference to invariant about presence + public var condition: [FHIRPrimitive]? + + /// Condition that must evaluate to true + public var constraint: [ElementDefinitionConstraint]? + + /// If the element must supported + public var mustSupport: FHIRPrimitive? + + /// If this modifies the meaning of other elements + public var isModifier: FHIRPrimitive? + + /// Include when _summary = true? + public var isSummary: FHIRPrimitive? + + /// ValueSet details if this is coded + public var binding: ElementDefinitionBinding? + + /// Map element to another set of definitions + public var mapping: [ElementDefinitionMapping]? + + /// Designated initializer taking all required properties + public init(path: FHIRPrimitive) { + self.path = path + super.init() + } + + /// Convenience initializer + public convenience init( + alias: [FHIRPrimitive]? = nil, + base: ElementDefinitionBase? = nil, + binding: ElementDefinitionBinding? = nil, + code: [Coding]? = nil, + comment: FHIRPrimitive? = nil, + condition: [FHIRPrimitive]? = nil, + constraint: [ElementDefinitionConstraint]? = nil, + contentReference: FHIRPrimitive? = nil, + defaultValue: DefaultValueX? = nil, + definition: FHIRPrimitive? = nil, + example: [ElementDefinitionExample]? = nil, + `extension`: [Extension]? = nil, + fixed: FixedX? = nil, + id: FHIRPrimitive? = nil, + isModifier: FHIRPrimitive? = nil, + isSummary: FHIRPrimitive? = nil, + label: FHIRPrimitive? = nil, + mapping: [ElementDefinitionMapping]? = nil, + max: FHIRPrimitive? = nil, + maxLength: FHIRPrimitive? = nil, + maxValue: MaxValueX? = nil, + meaningWhenMissing: FHIRPrimitive? = nil, + min: FHIRPrimitive? = nil, + minValue: MinValueX? = nil, + mustSupport: FHIRPrimitive? = nil, + orderMeaning: FHIRPrimitive? = nil, + path: FHIRPrimitive, + pattern: PatternX? = nil, + representation: [FHIRPrimitive]? = nil, + requirements: FHIRPrimitive? = nil, + short: FHIRPrimitive? = nil, + sliceName: FHIRPrimitive? = nil, + slicing: ElementDefinitionSlicing? = nil, + type: [ElementDefinitionType]? = nil) + { + self.init(path: path) + self.alias = alias + self.base = base + self.binding = binding + self.code = code + self.comment = comment + self.condition = condition + self.constraint = constraint + self.contentReference = contentReference + self.defaultValue = defaultValue + self.definition = definition + self.example = example + self.`extension` = `extension` + self.fixed = fixed + self.id = id + self.isModifier = isModifier + self.isSummary = isSummary + self.label = label + self.mapping = mapping + self.max = max + self.maxLength = maxLength + self.maxValue = maxValue + self.meaningWhenMissing = meaningWhenMissing + self.min = min + self.minValue = minValue + self.mustSupport = mustSupport + self.orderMeaning = orderMeaning + self.pattern = pattern + self.representation = representation + self.requirements = requirements + self.short = short + self.sliceName = sliceName + self.slicing = slicing + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case alias; case _alias + case base + case binding + case code + case comment; case _comment + case condition; case _condition + case constraint + case contentReference; case _contentReference + case defaultValueAddress + case defaultValueAge + case defaultValueAnnotation + case defaultValueAttachment + case defaultValueBase64Binary; case _defaultValueBase64Binary + case defaultValueBoolean; case _defaultValueBoolean + case defaultValueCode; case _defaultValueCode + case defaultValueCodeableConcept + case defaultValueCoding + case defaultValueContactPoint + case defaultValueCount + case defaultValueDate; case _defaultValueDate + case defaultValueDateTime; case _defaultValueDateTime + case defaultValueDecimal; case _defaultValueDecimal + case defaultValueDistance + case defaultValueDuration + case defaultValueHumanName + case defaultValueId; case _defaultValueId + case defaultValueIdentifier + case defaultValueInstant; case _defaultValueInstant + case defaultValueInteger; case _defaultValueInteger + case defaultValueMarkdown; case _defaultValueMarkdown + case defaultValueMeta + case defaultValueMoney + case defaultValueOid; case _defaultValueOid + case defaultValuePeriod + case defaultValuePositiveInt; case _defaultValuePositiveInt + case defaultValueQuantity + case defaultValueRange + case defaultValueRatio + case defaultValueReference + case defaultValueSampledData + case defaultValueSignature + case defaultValueString; case _defaultValueString + case defaultValueTime; case _defaultValueTime + case defaultValueTiming + case defaultValueUnsignedInt; case _defaultValueUnsignedInt + case defaultValueUri; case _defaultValueUri + case definition; case _definition + case example + case fixedAddress + case fixedAge + case fixedAnnotation + case fixedAttachment + case fixedBase64Binary; case _fixedBase64Binary + case fixedBoolean; case _fixedBoolean + case fixedCode; case _fixedCode + case fixedCodeableConcept + case fixedCoding + case fixedContactPoint + case fixedCount + case fixedDate; case _fixedDate + case fixedDateTime; case _fixedDateTime + case fixedDecimal; case _fixedDecimal + case fixedDistance + case fixedDuration + case fixedHumanName + case fixedId; case _fixedId + case fixedIdentifier + case fixedInstant; case _fixedInstant + case fixedInteger; case _fixedInteger + case fixedMarkdown; case _fixedMarkdown + case fixedMeta + case fixedMoney + case fixedOid; case _fixedOid + case fixedPeriod + case fixedPositiveInt; case _fixedPositiveInt + case fixedQuantity + case fixedRange + case fixedRatio + case fixedReference + case fixedSampledData + case fixedSignature + case fixedString; case _fixedString + case fixedTime; case _fixedTime + case fixedTiming + case fixedUnsignedInt; case _fixedUnsignedInt + case fixedUri; case _fixedUri + case isModifier; case _isModifier + case isSummary; case _isSummary + case label; case _label + case mapping + case max; case _max + case maxLength; case _maxLength + case maxValueDate; case _maxValueDate + case maxValueDateTime; case _maxValueDateTime + case maxValueDecimal; case _maxValueDecimal + case maxValueInstant; case _maxValueInstant + case maxValueInteger; case _maxValueInteger + case maxValuePositiveInt; case _maxValuePositiveInt + case maxValueQuantity + case maxValueTime; case _maxValueTime + case maxValueUnsignedInt; case _maxValueUnsignedInt + case meaningWhenMissing; case _meaningWhenMissing + case min; case _min + case minValueDate; case _minValueDate + case minValueDateTime; case _minValueDateTime + case minValueDecimal; case _minValueDecimal + case minValueInstant; case _minValueInstant + case minValueInteger; case _minValueInteger + case minValuePositiveInt; case _minValuePositiveInt + case minValueQuantity + case minValueTime; case _minValueTime + case minValueUnsignedInt; case _minValueUnsignedInt + case mustSupport; case _mustSupport + case orderMeaning; case _orderMeaning + case path; case _path + case patternAddress + case patternAge + case patternAnnotation + case patternAttachment + case patternBase64Binary; case _patternBase64Binary + case patternBoolean; case _patternBoolean + case patternCode; case _patternCode + case patternCodeableConcept + case patternCoding + case patternContactPoint + case patternCount + case patternDate; case _patternDate + case patternDateTime; case _patternDateTime + case patternDecimal; case _patternDecimal + case patternDistance + case patternDuration + case patternHumanName + case patternId; case _patternId + case patternIdentifier + case patternInstant; case _patternInstant + case patternInteger; case _patternInteger + case patternMarkdown; case _patternMarkdown + case patternMeta + case patternMoney + case patternOid; case _patternOid + case patternPeriod + case patternPositiveInt; case _patternPositiveInt + case patternQuantity + case patternRange + case patternRatio + case patternReference + case patternSampledData + case patternSignature + case patternString; case _patternString + case patternTime; case _patternTime + case patternTiming + case patternUnsignedInt; case _patternUnsignedInt + case patternUri; case _patternUri + case representation; case _representation + case requirements; case _requirements + case short; case _short + case sliceName; case _sliceName + case slicing + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.alias = try [FHIRPrimitive](from: _container, forKeyIfPresent: .alias, auxiliaryKey: ._alias) + self.base = try ElementDefinitionBase(from: _container, forKeyIfPresent: .base) + self.binding = try ElementDefinitionBinding(from: _container, forKeyIfPresent: .binding) + self.code = try [Coding](from: _container, forKeyIfPresent: .code) + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.condition = try [FHIRPrimitive](from: _container, forKeyIfPresent: .condition, auxiliaryKey: ._condition) + self.constraint = try [ElementDefinitionConstraint](from: _container, forKeyIfPresent: .constraint) + self.contentReference = try FHIRPrimitive(from: _container, forKeyIfPresent: .contentReference, auxiliaryKey: ._contentReference) + var _t_defaultValue: DefaultValueX? = nil + if let defaultValueBase64Binary = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueBase64Binary, auxiliaryKey: ._defaultValueBase64Binary) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueBase64Binary, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .base64Binary(defaultValueBase64Binary) + } + if let defaultValueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueBoolean, auxiliaryKey: ._defaultValueBoolean) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueBoolean, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .boolean(defaultValueBoolean) + } + if let defaultValueCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueCode, auxiliaryKey: ._defaultValueCode) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueCode, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .code(defaultValueCode) + } + if let defaultValueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueDate, auxiliaryKey: ._defaultValueDate) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueDate, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .date(defaultValueDate) + } + if let defaultValueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueDateTime, auxiliaryKey: ._defaultValueDateTime) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueDateTime, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .dateTime(defaultValueDateTime) + } + if let defaultValueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueDecimal, auxiliaryKey: ._defaultValueDecimal) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueDecimal, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .decimal(defaultValueDecimal) + } + if let defaultValueId = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueId, auxiliaryKey: ._defaultValueId) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueId, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .id(defaultValueId) + } + if let defaultValueInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueInstant, auxiliaryKey: ._defaultValueInstant) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueInstant, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .instant(defaultValueInstant) + } + if let defaultValueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueInteger, auxiliaryKey: ._defaultValueInteger) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueInteger, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .integer(defaultValueInteger) + } + if let defaultValueMarkdown = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueMarkdown, auxiliaryKey: ._defaultValueMarkdown) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueMarkdown, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .markdown(defaultValueMarkdown) + } + if let defaultValueOid = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueOid, auxiliaryKey: ._defaultValueOid) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueOid, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .oid(defaultValueOid) + } + if let defaultValuePositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValuePositiveInt, auxiliaryKey: ._defaultValuePositiveInt) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValuePositiveInt, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .positiveInt(defaultValuePositiveInt) + } + if let defaultValueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueString, auxiliaryKey: ._defaultValueString) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueString, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .string(defaultValueString) + } + if let defaultValueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueTime, auxiliaryKey: ._defaultValueTime) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueTime, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .time(defaultValueTime) + } + if let defaultValueUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueUnsignedInt, auxiliaryKey: ._defaultValueUnsignedInt) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueUnsignedInt, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .unsignedInt(defaultValueUnsignedInt) + } + if let defaultValueUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueUri, auxiliaryKey: ._defaultValueUri) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueUri, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .uri(defaultValueUri) + } + if let defaultValueAddress = try Address(from: _container, forKeyIfPresent: .defaultValueAddress) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueAddress, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .address(defaultValueAddress) + } + if let defaultValueAge = try Age(from: _container, forKeyIfPresent: .defaultValueAge) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueAge, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .age(defaultValueAge) + } + if let defaultValueAnnotation = try Annotation(from: _container, forKeyIfPresent: .defaultValueAnnotation) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueAnnotation, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .annotation(defaultValueAnnotation) + } + if let defaultValueAttachment = try Attachment(from: _container, forKeyIfPresent: .defaultValueAttachment) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueAttachment, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .attachment(defaultValueAttachment) + } + if let defaultValueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .defaultValueCodeableConcept) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .codeableConcept(defaultValueCodeableConcept) + } + if let defaultValueCoding = try Coding(from: _container, forKeyIfPresent: .defaultValueCoding) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueCoding, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .coding(defaultValueCoding) + } + if let defaultValueContactPoint = try ContactPoint(from: _container, forKeyIfPresent: .defaultValueContactPoint) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueContactPoint, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .contactPoint(defaultValueContactPoint) + } + if let defaultValueCount = try Count(from: _container, forKeyIfPresent: .defaultValueCount) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueCount, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .count(defaultValueCount) + } + if let defaultValueDistance = try Distance(from: _container, forKeyIfPresent: .defaultValueDistance) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueDistance, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .distance(defaultValueDistance) + } + if let defaultValueDuration = try Duration(from: _container, forKeyIfPresent: .defaultValueDuration) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueDuration, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .duration(defaultValueDuration) + } + if let defaultValueHumanName = try HumanName(from: _container, forKeyIfPresent: .defaultValueHumanName) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueHumanName, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .humanName(defaultValueHumanName) + } + if let defaultValueIdentifier = try Identifier(from: _container, forKeyIfPresent: .defaultValueIdentifier) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueIdentifier, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .identifier(defaultValueIdentifier) + } + if let defaultValueMoney = try Money(from: _container, forKeyIfPresent: .defaultValueMoney) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueMoney, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .money(defaultValueMoney) + } + if let defaultValuePeriod = try Period(from: _container, forKeyIfPresent: .defaultValuePeriod) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValuePeriod, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .period(defaultValuePeriod) + } + if let defaultValueQuantity = try Quantity(from: _container, forKeyIfPresent: .defaultValueQuantity) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueQuantity, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .quantity(defaultValueQuantity) + } + if let defaultValueRange = try Range(from: _container, forKeyIfPresent: .defaultValueRange) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueRange, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .range(defaultValueRange) + } + if let defaultValueRatio = try Ratio(from: _container, forKeyIfPresent: .defaultValueRatio) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueRatio, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .ratio(defaultValueRatio) + } + if let defaultValueReference = try Reference(from: _container, forKeyIfPresent: .defaultValueReference) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueReference, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .reference(defaultValueReference) + } + if let defaultValueSampledData = try SampledData(from: _container, forKeyIfPresent: .defaultValueSampledData) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueSampledData, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .sampledData(defaultValueSampledData) + } + if let defaultValueSignature = try Signature(from: _container, forKeyIfPresent: .defaultValueSignature) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueSignature, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .signature(defaultValueSignature) + } + if let defaultValueTiming = try Timing(from: _container, forKeyIfPresent: .defaultValueTiming) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueTiming, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .timing(defaultValueTiming) + } + if let defaultValueMeta = try Meta(from: _container, forKeyIfPresent: .defaultValueMeta) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueMeta, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .meta(defaultValueMeta) + } + self.defaultValue = _t_defaultValue + self.definition = try FHIRPrimitive(from: _container, forKeyIfPresent: .definition, auxiliaryKey: ._definition) + self.example = try [ElementDefinitionExample](from: _container, forKeyIfPresent: .example) + var _t_fixed: FixedX? = nil + if let fixedBase64Binary = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedBase64Binary, auxiliaryKey: ._fixedBase64Binary) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedBase64Binary, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .base64Binary(fixedBase64Binary) + } + if let fixedBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedBoolean, auxiliaryKey: ._fixedBoolean) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedBoolean, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .boolean(fixedBoolean) + } + if let fixedCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedCode, auxiliaryKey: ._fixedCode) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedCode, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .code(fixedCode) + } + if let fixedDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedDate, auxiliaryKey: ._fixedDate) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedDate, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .date(fixedDate) + } + if let fixedDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedDateTime, auxiliaryKey: ._fixedDateTime) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedDateTime, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .dateTime(fixedDateTime) + } + if let fixedDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedDecimal, auxiliaryKey: ._fixedDecimal) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedDecimal, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .decimal(fixedDecimal) + } + if let fixedId = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedId, auxiliaryKey: ._fixedId) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedId, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .id(fixedId) + } + if let fixedInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedInstant, auxiliaryKey: ._fixedInstant) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedInstant, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .instant(fixedInstant) + } + if let fixedInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedInteger, auxiliaryKey: ._fixedInteger) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedInteger, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .integer(fixedInteger) + } + if let fixedMarkdown = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedMarkdown, auxiliaryKey: ._fixedMarkdown) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedMarkdown, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .markdown(fixedMarkdown) + } + if let fixedOid = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedOid, auxiliaryKey: ._fixedOid) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedOid, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .oid(fixedOid) + } + if let fixedPositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedPositiveInt, auxiliaryKey: ._fixedPositiveInt) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedPositiveInt, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .positiveInt(fixedPositiveInt) + } + if let fixedString = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedString, auxiliaryKey: ._fixedString) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedString, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .string(fixedString) + } + if let fixedTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedTime, auxiliaryKey: ._fixedTime) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedTime, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .time(fixedTime) + } + if let fixedUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedUnsignedInt, auxiliaryKey: ._fixedUnsignedInt) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedUnsignedInt, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .unsignedInt(fixedUnsignedInt) + } + if let fixedUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .fixedUri, auxiliaryKey: ._fixedUri) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedUri, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .uri(fixedUri) + } + if let fixedAddress = try Address(from: _container, forKeyIfPresent: .fixedAddress) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedAddress, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .address(fixedAddress) + } + if let fixedAge = try Age(from: _container, forKeyIfPresent: .fixedAge) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedAge, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .age(fixedAge) + } + if let fixedAnnotation = try Annotation(from: _container, forKeyIfPresent: .fixedAnnotation) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedAnnotation, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .annotation(fixedAnnotation) + } + if let fixedAttachment = try Attachment(from: _container, forKeyIfPresent: .fixedAttachment) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedAttachment, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .attachment(fixedAttachment) + } + if let fixedCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .fixedCodeableConcept) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedCodeableConcept, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .codeableConcept(fixedCodeableConcept) + } + if let fixedCoding = try Coding(from: _container, forKeyIfPresent: .fixedCoding) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedCoding, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .coding(fixedCoding) + } + if let fixedContactPoint = try ContactPoint(from: _container, forKeyIfPresent: .fixedContactPoint) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedContactPoint, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .contactPoint(fixedContactPoint) + } + if let fixedCount = try Count(from: _container, forKeyIfPresent: .fixedCount) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedCount, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .count(fixedCount) + } + if let fixedDistance = try Distance(from: _container, forKeyIfPresent: .fixedDistance) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedDistance, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .distance(fixedDistance) + } + if let fixedDuration = try Duration(from: _container, forKeyIfPresent: .fixedDuration) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedDuration, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .duration(fixedDuration) + } + if let fixedHumanName = try HumanName(from: _container, forKeyIfPresent: .fixedHumanName) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedHumanName, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .humanName(fixedHumanName) + } + if let fixedIdentifier = try Identifier(from: _container, forKeyIfPresent: .fixedIdentifier) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedIdentifier, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .identifier(fixedIdentifier) + } + if let fixedMoney = try Money(from: _container, forKeyIfPresent: .fixedMoney) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedMoney, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .money(fixedMoney) + } + if let fixedPeriod = try Period(from: _container, forKeyIfPresent: .fixedPeriod) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedPeriod, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .period(fixedPeriod) + } + if let fixedQuantity = try Quantity(from: _container, forKeyIfPresent: .fixedQuantity) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedQuantity, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .quantity(fixedQuantity) + } + if let fixedRange = try Range(from: _container, forKeyIfPresent: .fixedRange) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedRange, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .range(fixedRange) + } + if let fixedRatio = try Ratio(from: _container, forKeyIfPresent: .fixedRatio) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedRatio, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .ratio(fixedRatio) + } + if let fixedReference = try Reference(from: _container, forKeyIfPresent: .fixedReference) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedReference, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .reference(fixedReference) + } + if let fixedSampledData = try SampledData(from: _container, forKeyIfPresent: .fixedSampledData) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedSampledData, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .sampledData(fixedSampledData) + } + if let fixedSignature = try Signature(from: _container, forKeyIfPresent: .fixedSignature) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedSignature, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .signature(fixedSignature) + } + if let fixedTiming = try Timing(from: _container, forKeyIfPresent: .fixedTiming) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedTiming, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .timing(fixedTiming) + } + if let fixedMeta = try Meta(from: _container, forKeyIfPresent: .fixedMeta) { + if _t_fixed != nil { + throw DecodingError.dataCorruptedError(forKey: .fixedMeta, in: _container, debugDescription: "More than one value provided for \"fixed\"") + } + _t_fixed = .meta(fixedMeta) + } + self.fixed = _t_fixed + self.isModifier = try FHIRPrimitive(from: _container, forKeyIfPresent: .isModifier, auxiliaryKey: ._isModifier) + self.isSummary = try FHIRPrimitive(from: _container, forKeyIfPresent: .isSummary, auxiliaryKey: ._isSummary) + self.label = try FHIRPrimitive(from: _container, forKeyIfPresent: .label, auxiliaryKey: ._label) + self.mapping = try [ElementDefinitionMapping](from: _container, forKeyIfPresent: .mapping) + self.max = try FHIRPrimitive(from: _container, forKeyIfPresent: .max, auxiliaryKey: ._max) + self.maxLength = try FHIRPrimitive(from: _container, forKeyIfPresent: .maxLength, auxiliaryKey: ._maxLength) + var _t_maxValue: MaxValueX? = nil + if let maxValueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .maxValueDate, auxiliaryKey: ._maxValueDate) { + if _t_maxValue != nil { + throw DecodingError.dataCorruptedError(forKey: .maxValueDate, in: _container, debugDescription: "More than one value provided for \"maxValue\"") + } + _t_maxValue = .date(maxValueDate) + } + if let maxValueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .maxValueDateTime, auxiliaryKey: ._maxValueDateTime) { + if _t_maxValue != nil { + throw DecodingError.dataCorruptedError(forKey: .maxValueDateTime, in: _container, debugDescription: "More than one value provided for \"maxValue\"") + } + _t_maxValue = .dateTime(maxValueDateTime) + } + if let maxValueInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .maxValueInstant, auxiliaryKey: ._maxValueInstant) { + if _t_maxValue != nil { + throw DecodingError.dataCorruptedError(forKey: .maxValueInstant, in: _container, debugDescription: "More than one value provided for \"maxValue\"") + } + _t_maxValue = .instant(maxValueInstant) + } + if let maxValueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .maxValueTime, auxiliaryKey: ._maxValueTime) { + if _t_maxValue != nil { + throw DecodingError.dataCorruptedError(forKey: .maxValueTime, in: _container, debugDescription: "More than one value provided for \"maxValue\"") + } + _t_maxValue = .time(maxValueTime) + } + if let maxValueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .maxValueDecimal, auxiliaryKey: ._maxValueDecimal) { + if _t_maxValue != nil { + throw DecodingError.dataCorruptedError(forKey: .maxValueDecimal, in: _container, debugDescription: "More than one value provided for \"maxValue\"") + } + _t_maxValue = .decimal(maxValueDecimal) + } + if let maxValueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .maxValueInteger, auxiliaryKey: ._maxValueInteger) { + if _t_maxValue != nil { + throw DecodingError.dataCorruptedError(forKey: .maxValueInteger, in: _container, debugDescription: "More than one value provided for \"maxValue\"") + } + _t_maxValue = .integer(maxValueInteger) + } + if let maxValuePositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .maxValuePositiveInt, auxiliaryKey: ._maxValuePositiveInt) { + if _t_maxValue != nil { + throw DecodingError.dataCorruptedError(forKey: .maxValuePositiveInt, in: _container, debugDescription: "More than one value provided for \"maxValue\"") + } + _t_maxValue = .positiveInt(maxValuePositiveInt) + } + if let maxValueUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .maxValueUnsignedInt, auxiliaryKey: ._maxValueUnsignedInt) { + if _t_maxValue != nil { + throw DecodingError.dataCorruptedError(forKey: .maxValueUnsignedInt, in: _container, debugDescription: "More than one value provided for \"maxValue\"") + } + _t_maxValue = .unsignedInt(maxValueUnsignedInt) + } + if let maxValueQuantity = try Quantity(from: _container, forKeyIfPresent: .maxValueQuantity) { + if _t_maxValue != nil { + throw DecodingError.dataCorruptedError(forKey: .maxValueQuantity, in: _container, debugDescription: "More than one value provided for \"maxValue\"") + } + _t_maxValue = .quantity(maxValueQuantity) + } + self.maxValue = _t_maxValue + self.meaningWhenMissing = try FHIRPrimitive(from: _container, forKeyIfPresent: .meaningWhenMissing, auxiliaryKey: ._meaningWhenMissing) + self.min = try FHIRPrimitive(from: _container, forKeyIfPresent: .min, auxiliaryKey: ._min) + var _t_minValue: MinValueX? = nil + if let minValueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .minValueDate, auxiliaryKey: ._minValueDate) { + if _t_minValue != nil { + throw DecodingError.dataCorruptedError(forKey: .minValueDate, in: _container, debugDescription: "More than one value provided for \"minValue\"") + } + _t_minValue = .date(minValueDate) + } + if let minValueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .minValueDateTime, auxiliaryKey: ._minValueDateTime) { + if _t_minValue != nil { + throw DecodingError.dataCorruptedError(forKey: .minValueDateTime, in: _container, debugDescription: "More than one value provided for \"minValue\"") + } + _t_minValue = .dateTime(minValueDateTime) + } + if let minValueInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .minValueInstant, auxiliaryKey: ._minValueInstant) { + if _t_minValue != nil { + throw DecodingError.dataCorruptedError(forKey: .minValueInstant, in: _container, debugDescription: "More than one value provided for \"minValue\"") + } + _t_minValue = .instant(minValueInstant) + } + if let minValueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .minValueTime, auxiliaryKey: ._minValueTime) { + if _t_minValue != nil { + throw DecodingError.dataCorruptedError(forKey: .minValueTime, in: _container, debugDescription: "More than one value provided for \"minValue\"") + } + _t_minValue = .time(minValueTime) + } + if let minValueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .minValueDecimal, auxiliaryKey: ._minValueDecimal) { + if _t_minValue != nil { + throw DecodingError.dataCorruptedError(forKey: .minValueDecimal, in: _container, debugDescription: "More than one value provided for \"minValue\"") + } + _t_minValue = .decimal(minValueDecimal) + } + if let minValueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .minValueInteger, auxiliaryKey: ._minValueInteger) { + if _t_minValue != nil { + throw DecodingError.dataCorruptedError(forKey: .minValueInteger, in: _container, debugDescription: "More than one value provided for \"minValue\"") + } + _t_minValue = .integer(minValueInteger) + } + if let minValuePositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .minValuePositiveInt, auxiliaryKey: ._minValuePositiveInt) { + if _t_minValue != nil { + throw DecodingError.dataCorruptedError(forKey: .minValuePositiveInt, in: _container, debugDescription: "More than one value provided for \"minValue\"") + } + _t_minValue = .positiveInt(minValuePositiveInt) + } + if let minValueUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .minValueUnsignedInt, auxiliaryKey: ._minValueUnsignedInt) { + if _t_minValue != nil { + throw DecodingError.dataCorruptedError(forKey: .minValueUnsignedInt, in: _container, debugDescription: "More than one value provided for \"minValue\"") + } + _t_minValue = .unsignedInt(minValueUnsignedInt) + } + if let minValueQuantity = try Quantity(from: _container, forKeyIfPresent: .minValueQuantity) { + if _t_minValue != nil { + throw DecodingError.dataCorruptedError(forKey: .minValueQuantity, in: _container, debugDescription: "More than one value provided for \"minValue\"") + } + _t_minValue = .quantity(minValueQuantity) + } + self.minValue = _t_minValue + self.mustSupport = try FHIRPrimitive(from: _container, forKeyIfPresent: .mustSupport, auxiliaryKey: ._mustSupport) + self.orderMeaning = try FHIRPrimitive(from: _container, forKeyIfPresent: .orderMeaning, auxiliaryKey: ._orderMeaning) + self.path = try FHIRPrimitive(from: _container, forKey: .path, auxiliaryKey: ._path) + var _t_pattern: PatternX? = nil + if let patternBase64Binary = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternBase64Binary, auxiliaryKey: ._patternBase64Binary) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternBase64Binary, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .base64Binary(patternBase64Binary) + } + if let patternBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternBoolean, auxiliaryKey: ._patternBoolean) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternBoolean, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .boolean(patternBoolean) + } + if let patternCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternCode, auxiliaryKey: ._patternCode) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternCode, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .code(patternCode) + } + if let patternDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternDate, auxiliaryKey: ._patternDate) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternDate, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .date(patternDate) + } + if let patternDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternDateTime, auxiliaryKey: ._patternDateTime) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternDateTime, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .dateTime(patternDateTime) + } + if let patternDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternDecimal, auxiliaryKey: ._patternDecimal) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternDecimal, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .decimal(patternDecimal) + } + if let patternId = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternId, auxiliaryKey: ._patternId) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternId, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .id(patternId) + } + if let patternInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternInstant, auxiliaryKey: ._patternInstant) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternInstant, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .instant(patternInstant) + } + if let patternInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternInteger, auxiliaryKey: ._patternInteger) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternInteger, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .integer(patternInteger) + } + if let patternMarkdown = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternMarkdown, auxiliaryKey: ._patternMarkdown) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternMarkdown, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .markdown(patternMarkdown) + } + if let patternOid = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternOid, auxiliaryKey: ._patternOid) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternOid, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .oid(patternOid) + } + if let patternPositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternPositiveInt, auxiliaryKey: ._patternPositiveInt) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternPositiveInt, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .positiveInt(patternPositiveInt) + } + if let patternString = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternString, auxiliaryKey: ._patternString) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternString, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .string(patternString) + } + if let patternTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternTime, auxiliaryKey: ._patternTime) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternTime, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .time(patternTime) + } + if let patternUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternUnsignedInt, auxiliaryKey: ._patternUnsignedInt) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternUnsignedInt, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .unsignedInt(patternUnsignedInt) + } + if let patternUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .patternUri, auxiliaryKey: ._patternUri) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternUri, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .uri(patternUri) + } + if let patternAddress = try Address(from: _container, forKeyIfPresent: .patternAddress) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternAddress, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .address(patternAddress) + } + if let patternAge = try Age(from: _container, forKeyIfPresent: .patternAge) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternAge, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .age(patternAge) + } + if let patternAnnotation = try Annotation(from: _container, forKeyIfPresent: .patternAnnotation) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternAnnotation, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .annotation(patternAnnotation) + } + if let patternAttachment = try Attachment(from: _container, forKeyIfPresent: .patternAttachment) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternAttachment, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .attachment(patternAttachment) + } + if let patternCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .patternCodeableConcept) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternCodeableConcept, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .codeableConcept(patternCodeableConcept) + } + if let patternCoding = try Coding(from: _container, forKeyIfPresent: .patternCoding) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternCoding, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .coding(patternCoding) + } + if let patternContactPoint = try ContactPoint(from: _container, forKeyIfPresent: .patternContactPoint) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternContactPoint, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .contactPoint(patternContactPoint) + } + if let patternCount = try Count(from: _container, forKeyIfPresent: .patternCount) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternCount, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .count(patternCount) + } + if let patternDistance = try Distance(from: _container, forKeyIfPresent: .patternDistance) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternDistance, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .distance(patternDistance) + } + if let patternDuration = try Duration(from: _container, forKeyIfPresent: .patternDuration) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternDuration, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .duration(patternDuration) + } + if let patternHumanName = try HumanName(from: _container, forKeyIfPresent: .patternHumanName) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternHumanName, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .humanName(patternHumanName) + } + if let patternIdentifier = try Identifier(from: _container, forKeyIfPresent: .patternIdentifier) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternIdentifier, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .identifier(patternIdentifier) + } + if let patternMoney = try Money(from: _container, forKeyIfPresent: .patternMoney) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternMoney, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .money(patternMoney) + } + if let patternPeriod = try Period(from: _container, forKeyIfPresent: .patternPeriod) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternPeriod, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .period(patternPeriod) + } + if let patternQuantity = try Quantity(from: _container, forKeyIfPresent: .patternQuantity) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternQuantity, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .quantity(patternQuantity) + } + if let patternRange = try Range(from: _container, forKeyIfPresent: .patternRange) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternRange, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .range(patternRange) + } + if let patternRatio = try Ratio(from: _container, forKeyIfPresent: .patternRatio) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternRatio, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .ratio(patternRatio) + } + if let patternReference = try Reference(from: _container, forKeyIfPresent: .patternReference) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternReference, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .reference(patternReference) + } + if let patternSampledData = try SampledData(from: _container, forKeyIfPresent: .patternSampledData) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternSampledData, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .sampledData(patternSampledData) + } + if let patternSignature = try Signature(from: _container, forKeyIfPresent: .patternSignature) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternSignature, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .signature(patternSignature) + } + if let patternTiming = try Timing(from: _container, forKeyIfPresent: .patternTiming) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternTiming, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .timing(patternTiming) + } + if let patternMeta = try Meta(from: _container, forKeyIfPresent: .patternMeta) { + if _t_pattern != nil { + throw DecodingError.dataCorruptedError(forKey: .patternMeta, in: _container, debugDescription: "More than one value provided for \"pattern\"") + } + _t_pattern = .meta(patternMeta) + } + self.pattern = _t_pattern + self.representation = try [FHIRPrimitive](from: _container, forKeyIfPresent: .representation, auxiliaryKey: ._representation) + self.requirements = try FHIRPrimitive(from: _container, forKeyIfPresent: .requirements, auxiliaryKey: ._requirements) + self.short = try FHIRPrimitive(from: _container, forKeyIfPresent: .short, auxiliaryKey: ._short) + self.sliceName = try FHIRPrimitive(from: _container, forKeyIfPresent: .sliceName, auxiliaryKey: ._sliceName) + self.slicing = try ElementDefinitionSlicing(from: _container, forKeyIfPresent: .slicing) + self.type = try [ElementDefinitionType](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try alias?.encode(on: &_container, forKey: .alias, auxiliaryKey: ._alias) + try base?.encode(on: &_container, forKey: .base) + try binding?.encode(on: &_container, forKey: .binding) + try code?.encode(on: &_container, forKey: .code) + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try condition?.encode(on: &_container, forKey: .condition, auxiliaryKey: ._condition) + try constraint?.encode(on: &_container, forKey: .constraint) + try contentReference?.encode(on: &_container, forKey: .contentReference, auxiliaryKey: ._contentReference) + if let _enum = defaultValue { + switch _enum { + case .base64Binary(let _value): + try _value.encode(on: &_container, forKey: .defaultValueBase64Binary, auxiliaryKey: ._defaultValueBase64Binary) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .defaultValueBoolean, auxiliaryKey: ._defaultValueBoolean) + case .code(let _value): + try _value.encode(on: &_container, forKey: .defaultValueCode, auxiliaryKey: ._defaultValueCode) + case .date(let _value): + try _value.encode(on: &_container, forKey: .defaultValueDate, auxiliaryKey: ._defaultValueDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .defaultValueDateTime, auxiliaryKey: ._defaultValueDateTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .defaultValueDecimal, auxiliaryKey: ._defaultValueDecimal) + case .id(let _value): + try _value.encode(on: &_container, forKey: .defaultValueId, auxiliaryKey: ._defaultValueId) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .defaultValueInstant, auxiliaryKey: ._defaultValueInstant) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .defaultValueInteger, auxiliaryKey: ._defaultValueInteger) + case .markdown(let _value): + try _value.encode(on: &_container, forKey: .defaultValueMarkdown, auxiliaryKey: ._defaultValueMarkdown) + case .oid(let _value): + try _value.encode(on: &_container, forKey: .defaultValueOid, auxiliaryKey: ._defaultValueOid) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .defaultValuePositiveInt, auxiliaryKey: ._defaultValuePositiveInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .defaultValueString, auxiliaryKey: ._defaultValueString) + case .time(let _value): + try _value.encode(on: &_container, forKey: .defaultValueTime, auxiliaryKey: ._defaultValueTime) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .defaultValueUnsignedInt, auxiliaryKey: ._defaultValueUnsignedInt) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .defaultValueUri, auxiliaryKey: ._defaultValueUri) + case .address(let _value): + try _value.encode(on: &_container, forKey: .defaultValueAddress) + case .age(let _value): + try _value.encode(on: &_container, forKey: .defaultValueAge) + case .annotation(let _value): + try _value.encode(on: &_container, forKey: .defaultValueAnnotation) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .defaultValueAttachment) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .defaultValueCodeableConcept) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .defaultValueCoding) + case .contactPoint(let _value): + try _value.encode(on: &_container, forKey: .defaultValueContactPoint) + case .count(let _value): + try _value.encode(on: &_container, forKey: .defaultValueCount) + case .distance(let _value): + try _value.encode(on: &_container, forKey: .defaultValueDistance) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .defaultValueDuration) + case .humanName(let _value): + try _value.encode(on: &_container, forKey: .defaultValueHumanName) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .defaultValueIdentifier) + case .money(let _value): + try _value.encode(on: &_container, forKey: .defaultValueMoney) + case .period(let _value): + try _value.encode(on: &_container, forKey: .defaultValuePeriod) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .defaultValueQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .defaultValueRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .defaultValueRatio) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .defaultValueReference) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .defaultValueSampledData) + case .signature(let _value): + try _value.encode(on: &_container, forKey: .defaultValueSignature) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .defaultValueTiming) + case .meta(let _value): + try _value.encode(on: &_container, forKey: .defaultValueMeta) + } + } + try definition?.encode(on: &_container, forKey: .definition, auxiliaryKey: ._definition) + try example?.encode(on: &_container, forKey: .example) + if let _enum = fixed { + switch _enum { + case .base64Binary(let _value): + try _value.encode(on: &_container, forKey: .fixedBase64Binary, auxiliaryKey: ._fixedBase64Binary) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .fixedBoolean, auxiliaryKey: ._fixedBoolean) + case .code(let _value): + try _value.encode(on: &_container, forKey: .fixedCode, auxiliaryKey: ._fixedCode) + case .date(let _value): + try _value.encode(on: &_container, forKey: .fixedDate, auxiliaryKey: ._fixedDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .fixedDateTime, auxiliaryKey: ._fixedDateTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .fixedDecimal, auxiliaryKey: ._fixedDecimal) + case .id(let _value): + try _value.encode(on: &_container, forKey: .fixedId, auxiliaryKey: ._fixedId) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .fixedInstant, auxiliaryKey: ._fixedInstant) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .fixedInteger, auxiliaryKey: ._fixedInteger) + case .markdown(let _value): + try _value.encode(on: &_container, forKey: .fixedMarkdown, auxiliaryKey: ._fixedMarkdown) + case .oid(let _value): + try _value.encode(on: &_container, forKey: .fixedOid, auxiliaryKey: ._fixedOid) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .fixedPositiveInt, auxiliaryKey: ._fixedPositiveInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .fixedString, auxiliaryKey: ._fixedString) + case .time(let _value): + try _value.encode(on: &_container, forKey: .fixedTime, auxiliaryKey: ._fixedTime) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .fixedUnsignedInt, auxiliaryKey: ._fixedUnsignedInt) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .fixedUri, auxiliaryKey: ._fixedUri) + case .address(let _value): + try _value.encode(on: &_container, forKey: .fixedAddress) + case .age(let _value): + try _value.encode(on: &_container, forKey: .fixedAge) + case .annotation(let _value): + try _value.encode(on: &_container, forKey: .fixedAnnotation) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .fixedAttachment) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .fixedCodeableConcept) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .fixedCoding) + case .contactPoint(let _value): + try _value.encode(on: &_container, forKey: .fixedContactPoint) + case .count(let _value): + try _value.encode(on: &_container, forKey: .fixedCount) + case .distance(let _value): + try _value.encode(on: &_container, forKey: .fixedDistance) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .fixedDuration) + case .humanName(let _value): + try _value.encode(on: &_container, forKey: .fixedHumanName) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .fixedIdentifier) + case .money(let _value): + try _value.encode(on: &_container, forKey: .fixedMoney) + case .period(let _value): + try _value.encode(on: &_container, forKey: .fixedPeriod) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .fixedQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .fixedRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .fixedRatio) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .fixedReference) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .fixedSampledData) + case .signature(let _value): + try _value.encode(on: &_container, forKey: .fixedSignature) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .fixedTiming) + case .meta(let _value): + try _value.encode(on: &_container, forKey: .fixedMeta) + } + } + try isModifier?.encode(on: &_container, forKey: .isModifier, auxiliaryKey: ._isModifier) + try isSummary?.encode(on: &_container, forKey: .isSummary, auxiliaryKey: ._isSummary) + try label?.encode(on: &_container, forKey: .label, auxiliaryKey: ._label) + try mapping?.encode(on: &_container, forKey: .mapping) + try max?.encode(on: &_container, forKey: .max, auxiliaryKey: ._max) + try maxLength?.encode(on: &_container, forKey: .maxLength, auxiliaryKey: ._maxLength) + if let _enum = maxValue { + switch _enum { + case .date(let _value): + try _value.encode(on: &_container, forKey: .maxValueDate, auxiliaryKey: ._maxValueDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .maxValueDateTime, auxiliaryKey: ._maxValueDateTime) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .maxValueInstant, auxiliaryKey: ._maxValueInstant) + case .time(let _value): + try _value.encode(on: &_container, forKey: .maxValueTime, auxiliaryKey: ._maxValueTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .maxValueDecimal, auxiliaryKey: ._maxValueDecimal) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .maxValueInteger, auxiliaryKey: ._maxValueInteger) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .maxValuePositiveInt, auxiliaryKey: ._maxValuePositiveInt) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .maxValueUnsignedInt, auxiliaryKey: ._maxValueUnsignedInt) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .maxValueQuantity) + } + } + try meaningWhenMissing?.encode(on: &_container, forKey: .meaningWhenMissing, auxiliaryKey: ._meaningWhenMissing) + try min?.encode(on: &_container, forKey: .min, auxiliaryKey: ._min) + if let _enum = minValue { + switch _enum { + case .date(let _value): + try _value.encode(on: &_container, forKey: .minValueDate, auxiliaryKey: ._minValueDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .minValueDateTime, auxiliaryKey: ._minValueDateTime) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .minValueInstant, auxiliaryKey: ._minValueInstant) + case .time(let _value): + try _value.encode(on: &_container, forKey: .minValueTime, auxiliaryKey: ._minValueTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .minValueDecimal, auxiliaryKey: ._minValueDecimal) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .minValueInteger, auxiliaryKey: ._minValueInteger) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .minValuePositiveInt, auxiliaryKey: ._minValuePositiveInt) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .minValueUnsignedInt, auxiliaryKey: ._minValueUnsignedInt) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .minValueQuantity) + } + } + try mustSupport?.encode(on: &_container, forKey: .mustSupport, auxiliaryKey: ._mustSupport) + try orderMeaning?.encode(on: &_container, forKey: .orderMeaning, auxiliaryKey: ._orderMeaning) + try path.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + if let _enum = pattern { + switch _enum { + case .base64Binary(let _value): + try _value.encode(on: &_container, forKey: .patternBase64Binary, auxiliaryKey: ._patternBase64Binary) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .patternBoolean, auxiliaryKey: ._patternBoolean) + case .code(let _value): + try _value.encode(on: &_container, forKey: .patternCode, auxiliaryKey: ._patternCode) + case .date(let _value): + try _value.encode(on: &_container, forKey: .patternDate, auxiliaryKey: ._patternDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .patternDateTime, auxiliaryKey: ._patternDateTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .patternDecimal, auxiliaryKey: ._patternDecimal) + case .id(let _value): + try _value.encode(on: &_container, forKey: .patternId, auxiliaryKey: ._patternId) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .patternInstant, auxiliaryKey: ._patternInstant) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .patternInteger, auxiliaryKey: ._patternInteger) + case .markdown(let _value): + try _value.encode(on: &_container, forKey: .patternMarkdown, auxiliaryKey: ._patternMarkdown) + case .oid(let _value): + try _value.encode(on: &_container, forKey: .patternOid, auxiliaryKey: ._patternOid) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .patternPositiveInt, auxiliaryKey: ._patternPositiveInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .patternString, auxiliaryKey: ._patternString) + case .time(let _value): + try _value.encode(on: &_container, forKey: .patternTime, auxiliaryKey: ._patternTime) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .patternUnsignedInt, auxiliaryKey: ._patternUnsignedInt) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .patternUri, auxiliaryKey: ._patternUri) + case .address(let _value): + try _value.encode(on: &_container, forKey: .patternAddress) + case .age(let _value): + try _value.encode(on: &_container, forKey: .patternAge) + case .annotation(let _value): + try _value.encode(on: &_container, forKey: .patternAnnotation) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .patternAttachment) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .patternCodeableConcept) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .patternCoding) + case .contactPoint(let _value): + try _value.encode(on: &_container, forKey: .patternContactPoint) + case .count(let _value): + try _value.encode(on: &_container, forKey: .patternCount) + case .distance(let _value): + try _value.encode(on: &_container, forKey: .patternDistance) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .patternDuration) + case .humanName(let _value): + try _value.encode(on: &_container, forKey: .patternHumanName) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .patternIdentifier) + case .money(let _value): + try _value.encode(on: &_container, forKey: .patternMoney) + case .period(let _value): + try _value.encode(on: &_container, forKey: .patternPeriod) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .patternQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .patternRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .patternRatio) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .patternReference) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .patternSampledData) + case .signature(let _value): + try _value.encode(on: &_container, forKey: .patternSignature) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .patternTiming) + case .meta(let _value): + try _value.encode(on: &_container, forKey: .patternMeta) + } + } + try representation?.encode(on: &_container, forKey: .representation, auxiliaryKey: ._representation) + try requirements?.encode(on: &_container, forKey: .requirements, auxiliaryKey: ._requirements) + try short?.encode(on: &_container, forKey: .short, auxiliaryKey: ._short) + try sliceName?.encode(on: &_container, forKey: .sliceName, auxiliaryKey: ._sliceName) + try slicing?.encode(on: &_container, forKey: .slicing) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ElementDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return alias == _other.alias + && base == _other.base + && binding == _other.binding + && code == _other.code + && comment == _other.comment + && condition == _other.condition + && constraint == _other.constraint + && contentReference == _other.contentReference + && defaultValue == _other.defaultValue + && definition == _other.definition + && example == _other.example + && fixed == _other.fixed + && isModifier == _other.isModifier + && isSummary == _other.isSummary + && label == _other.label + && mapping == _other.mapping + && max == _other.max + && maxLength == _other.maxLength + && maxValue == _other.maxValue + && meaningWhenMissing == _other.meaningWhenMissing + && min == _other.min + && minValue == _other.minValue + && mustSupport == _other.mustSupport + && orderMeaning == _other.orderMeaning + && path == _other.path + && pattern == _other.pattern + && representation == _other.representation + && requirements == _other.requirements + && short == _other.short + && sliceName == _other.sliceName + && slicing == _other.slicing + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(alias) + hasher.combine(base) + hasher.combine(binding) + hasher.combine(code) + hasher.combine(comment) + hasher.combine(condition) + hasher.combine(constraint) + hasher.combine(contentReference) + hasher.combine(defaultValue) + hasher.combine(definition) + hasher.combine(example) + hasher.combine(fixed) + hasher.combine(isModifier) + hasher.combine(isSummary) + hasher.combine(label) + hasher.combine(mapping) + hasher.combine(max) + hasher.combine(maxLength) + hasher.combine(maxValue) + hasher.combine(meaningWhenMissing) + hasher.combine(min) + hasher.combine(minValue) + hasher.combine(mustSupport) + hasher.combine(orderMeaning) + hasher.combine(path) + hasher.combine(pattern) + hasher.combine(representation) + hasher.combine(requirements) + hasher.combine(short) + hasher.combine(sliceName) + hasher.combine(slicing) + hasher.combine(type) + } +} + +/** + Base definition information for tools. + + Information about the base definition of the element, provided to make it unnecessary for tools to trace the deviation + of the element through the derived and related profiles. This information is provided when the element definition is + not the original definition of an element - i.g. either in a constraint on another type, or for elements from a super + type in a snap shot. + */ +open class ElementDefinitionBase: Element { + + /// Path that identifies the base element + public var path: FHIRPrimitive + + /// Min cardinality of the base element + public var min: FHIRPrimitive + + /// Max cardinality of the base element + public var max: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(max: FHIRPrimitive, min: FHIRPrimitive, path: FHIRPrimitive) { + self.max = max + self.min = min + self.path = path + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + max: FHIRPrimitive, + min: FHIRPrimitive, + path: FHIRPrimitive) + { + self.init(max: max, min: min, path: path) + self.`extension` = `extension` + self.id = id + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case max; case _max + case min; case _min + case path; case _path + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.max = try FHIRPrimitive(from: _container, forKey: .max, auxiliaryKey: ._max) + self.min = try FHIRPrimitive(from: _container, forKey: .min, auxiliaryKey: ._min) + self.path = try FHIRPrimitive(from: _container, forKey: .path, auxiliaryKey: ._path) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try max.encode(on: &_container, forKey: .max, auxiliaryKey: ._max) + try min.encode(on: &_container, forKey: .min, auxiliaryKey: ._min) + try path.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ElementDefinitionBase else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return max == _other.max + && min == _other.min + && path == _other.path + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(max) + hasher.combine(min) + hasher.combine(path) + } +} + +/** + ValueSet details if this is coded. + + Binds to a value set if this element is coded (code, Coding, CodeableConcept, Quantity), or the data types (string, + uri). + */ +open class ElementDefinitionBinding: Element { + + /// All possible types for "valueSet[x]" + public enum ValueSetX: Hashable { + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the + /// provided value set must be adhered to in the instances. + public var strength: FHIRPrimitive + + /// Human explanation of the value set + public var description_fhir: FHIRPrimitive? + + /// Source of value set + /// One of `valueSet[x]` + public var valueSet: ValueSetX? + + /// Designated initializer taking all required properties + public init(strength: FHIRPrimitive) { + self.strength = strength + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + strength: FHIRPrimitive, + valueSet: ValueSetX? = nil) + { + self.init(strength: strength) + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.valueSet = valueSet + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case strength; case _strength + case valueSetReference + case valueSetUri; case _valueSetUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.strength = try FHIRPrimitive(from: _container, forKey: .strength, auxiliaryKey: ._strength) + var _t_valueSet: ValueSetX? = nil + if let valueSetUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueSetUri, auxiliaryKey: ._valueSetUri) { + if _t_valueSet != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSetUri, in: _container, debugDescription: "More than one value provided for \"valueSet\"") + } + _t_valueSet = .uri(valueSetUri) + } + if let valueSetReference = try Reference(from: _container, forKeyIfPresent: .valueSetReference) { + if _t_valueSet != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSetReference, in: _container, debugDescription: "More than one value provided for \"valueSet\"") + } + _t_valueSet = .reference(valueSetReference) + } + self.valueSet = _t_valueSet + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try strength.encode(on: &_container, forKey: .strength, auxiliaryKey: ._strength) + if let _enum = valueSet { + switch _enum { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .valueSetUri, auxiliaryKey: ._valueSetUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueSetReference) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ElementDefinitionBinding else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && strength == _other.strength + && valueSet == _other.valueSet + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(strength) + hasher.combine(valueSet) + } +} + +/** + Condition that must evaluate to true. + + Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context + of the instance. + */ +open class ElementDefinitionConstraint: Element { + + /// Target of 'condition' reference above + public var key: FHIRPrimitive + + /// Why this constraint is necessary or appropriate + public var requirements: FHIRPrimitive? + + /// Identifies the impact constraint violation has on the conformance of the instance. + public var severity: FHIRPrimitive + + /// Human description of constraint + public var human: FHIRPrimitive + + /// FHIRPath expression of constraint + public var expression: FHIRPrimitive + + /// XPath expression of constraint + public var xpath: FHIRPrimitive? + + /// Reference to original source of constraint + public var source: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(expression: FHIRPrimitive, human: FHIRPrimitive, key: FHIRPrimitive, severity: FHIRPrimitive) { + self.expression = expression + self.human = human + self.key = key + self.severity = severity + super.init() + } + + /// Convenience initializer + public convenience init( + expression: FHIRPrimitive, + `extension`: [Extension]? = nil, + human: FHIRPrimitive, + id: FHIRPrimitive? = nil, + key: FHIRPrimitive, + requirements: FHIRPrimitive? = nil, + severity: FHIRPrimitive, + source: FHIRPrimitive? = nil, + xpath: FHIRPrimitive? = nil) + { + self.init(expression: expression, human: human, key: key, severity: severity) + self.`extension` = `extension` + self.id = id + self.requirements = requirements + self.source = source + self.xpath = xpath + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case expression; case _expression + case human; case _human + case key; case _key + case requirements; case _requirements + case severity; case _severity + case source; case _source + case xpath; case _xpath + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.expression = try FHIRPrimitive(from: _container, forKey: .expression, auxiliaryKey: ._expression) + self.human = try FHIRPrimitive(from: _container, forKey: .human, auxiliaryKey: ._human) + self.key = try FHIRPrimitive(from: _container, forKey: .key, auxiliaryKey: ._key) + self.requirements = try FHIRPrimitive(from: _container, forKeyIfPresent: .requirements, auxiliaryKey: ._requirements) + self.severity = try FHIRPrimitive(from: _container, forKey: .severity, auxiliaryKey: ._severity) + self.source = try FHIRPrimitive(from: _container, forKeyIfPresent: .source, auxiliaryKey: ._source) + self.xpath = try FHIRPrimitive(from: _container, forKeyIfPresent: .xpath, auxiliaryKey: ._xpath) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try expression.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try human.encode(on: &_container, forKey: .human, auxiliaryKey: ._human) + try key.encode(on: &_container, forKey: .key, auxiliaryKey: ._key) + try requirements?.encode(on: &_container, forKey: .requirements, auxiliaryKey: ._requirements) + try severity.encode(on: &_container, forKey: .severity, auxiliaryKey: ._severity) + try source?.encode(on: &_container, forKey: .source, auxiliaryKey: ._source) + try xpath?.encode(on: &_container, forKey: .xpath, auxiliaryKey: ._xpath) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ElementDefinitionConstraint else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return expression == _other.expression + && human == _other.human + && key == _other.key + && requirements == _other.requirements + && severity == _other.severity + && source == _other.source + && xpath == _other.xpath + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(expression) + hasher.combine(human) + hasher.combine(key) + hasher.combine(requirements) + hasher.combine(severity) + hasher.combine(source) + hasher.combine(xpath) + } +} + +/** + Example value (as defined for type). + + A sample value for this element demonstrating the type of information that would typically be found in the element. + */ +open class ElementDefinitionExample: Element { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case address(Address) + case age(Age) + case annotation(Annotation) + case attachment(Attachment) + case base64Binary(FHIRPrimitive) + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case coding(Coding) + case contactPoint(ContactPoint) + case count(Count) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case distance(Distance) + case duration(Duration) + case humanName(HumanName) + case id(FHIRPrimitive) + case identifier(Identifier) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case markdown(FHIRPrimitive) + case meta(Meta) + case money(Money) + case oid(FHIRPrimitive) + case period(Period) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case reference(Reference) + case sampledData(SampledData) + case signature(Signature) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case timing(Timing) + case unsignedInt(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// Describes the purpose of this example + public var label: FHIRPrimitive + + /// Value of Example (one of allowed types) + /// One of `value[x]` + public var value: ValueX + + /// Designated initializer taking all required properties + public init(label: FHIRPrimitive, value: ValueX) { + self.label = label + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + label: FHIRPrimitive, + value: ValueX) + { + self.init(label: label, value: value) + self.`extension` = `extension` + self.id = id + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case label; case _label + case valueAddress + case valueAge + case valueAnnotation + case valueAttachment + case valueBase64Binary; case _valueBase64Binary + case valueBoolean; case _valueBoolean + case valueCode; case _valueCode + case valueCodeableConcept + case valueCoding + case valueContactPoint + case valueCount + case valueDate; case _valueDate + case valueDateTime; case _valueDateTime + case valueDecimal; case _valueDecimal + case valueDistance + case valueDuration + case valueHumanName + case valueId; case _valueId + case valueIdentifier + case valueInstant; case _valueInstant + case valueInteger; case _valueInteger + case valueMarkdown; case _valueMarkdown + case valueMeta + case valueMoney + case valueOid; case _valueOid + case valuePeriod + case valuePositiveInt; case _valuePositiveInt + case valueQuantity + case valueRange + case valueRatio + case valueReference + case valueSampledData + case valueSignature + case valueString; case _valueString + case valueTime; case _valueTime + case valueTiming + case valueUnsignedInt; case _valueUnsignedInt + case valueUri; case _valueUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.valueAddress) || _container.contains(CodingKeys.valueAge) || _container.contains(CodingKeys.valueAnnotation) || _container.contains(CodingKeys.valueAttachment) || _container.contains(CodingKeys.valueBase64Binary) || _container.contains(CodingKeys.valueBoolean) || _container.contains(CodingKeys.valueCode) || _container.contains(CodingKeys.valueCodeableConcept) || _container.contains(CodingKeys.valueCoding) || _container.contains(CodingKeys.valueContactPoint) || _container.contains(CodingKeys.valueCount) || _container.contains(CodingKeys.valueDate) || _container.contains(CodingKeys.valueDateTime) || _container.contains(CodingKeys.valueDecimal) || _container.contains(CodingKeys.valueDistance) || _container.contains(CodingKeys.valueDuration) || _container.contains(CodingKeys.valueHumanName) || _container.contains(CodingKeys.valueId) || _container.contains(CodingKeys.valueIdentifier) || _container.contains(CodingKeys.valueInstant) || _container.contains(CodingKeys.valueInteger) || _container.contains(CodingKeys.valueMarkdown) || _container.contains(CodingKeys.valueMeta) || _container.contains(CodingKeys.valueMoney) || _container.contains(CodingKeys.valueOid) || _container.contains(CodingKeys.valuePeriod) || _container.contains(CodingKeys.valuePositiveInt) || _container.contains(CodingKeys.valueQuantity) || _container.contains(CodingKeys.valueRange) || _container.contains(CodingKeys.valueRatio) || _container.contains(CodingKeys.valueReference) || _container.contains(CodingKeys.valueSampledData) || _container.contains(CodingKeys.valueSignature) || _container.contains(CodingKeys.valueString) || _container.contains(CodingKeys.valueTime) || _container.contains(CodingKeys.valueTiming) || _container.contains(CodingKeys.valueUnsignedInt) || _container.contains(CodingKeys.valueUri) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.valueAddress, CodingKeys.valueAge, CodingKeys.valueAnnotation, CodingKeys.valueAttachment, CodingKeys.valueBase64Binary, CodingKeys.valueBoolean, CodingKeys.valueCode, CodingKeys.valueCodeableConcept, CodingKeys.valueCoding, CodingKeys.valueContactPoint, CodingKeys.valueCount, CodingKeys.valueDate, CodingKeys.valueDateTime, CodingKeys.valueDecimal, CodingKeys.valueDistance, CodingKeys.valueDuration, CodingKeys.valueHumanName, CodingKeys.valueId, CodingKeys.valueIdentifier, CodingKeys.valueInstant, CodingKeys.valueInteger, CodingKeys.valueMarkdown, CodingKeys.valueMeta, CodingKeys.valueMoney, CodingKeys.valueOid, CodingKeys.valuePeriod, CodingKeys.valuePositiveInt, CodingKeys.valueQuantity, CodingKeys.valueRange, CodingKeys.valueRatio, CodingKeys.valueReference, CodingKeys.valueSampledData, CodingKeys.valueSignature, CodingKeys.valueString, CodingKeys.valueTime, CodingKeys.valueTiming, CodingKeys.valueUnsignedInt, CodingKeys.valueUri], debugDescription: "Must have at least one value for \"value\" but have none")) + } + + // Decode all our properties + self.label = try FHIRPrimitive(from: _container, forKey: .label, auxiliaryKey: ._label) + var _t_value: ValueX? = nil + if let valueBase64Binary = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBase64Binary, auxiliaryKey: ._valueBase64Binary) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBase64Binary, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .base64Binary(valueBase64Binary) + } + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueCode, auxiliaryKey: ._valueCode) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCode, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .code(valueCode) + } + if let valueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDate, auxiliaryKey: ._valueDate) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDate, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .date(valueDate) + } + if let valueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDateTime, auxiliaryKey: ._valueDateTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDateTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .dateTime(valueDateTime) + } + if let valueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDecimal, auxiliaryKey: ._valueDecimal) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDecimal, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .decimal(valueDecimal) + } + if let valueId = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueId, auxiliaryKey: ._valueId) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueId, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .id(valueId) + } + if let valueInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInstant, auxiliaryKey: ._valueInstant) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInstant, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .instant(valueInstant) + } + if let valueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInteger, auxiliaryKey: ._valueInteger) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInteger, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .integer(valueInteger) + } + if let valueMarkdown = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueMarkdown, auxiliaryKey: ._valueMarkdown) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMarkdown, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .markdown(valueMarkdown) + } + if let valueOid = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueOid, auxiliaryKey: ._valueOid) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueOid, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .oid(valueOid) + } + if let valuePositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .valuePositiveInt, auxiliaryKey: ._valuePositiveInt) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePositiveInt, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .positiveInt(valuePositiveInt) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueTime, auxiliaryKey: ._valueTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .time(valueTime) + } + if let valueUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUnsignedInt, auxiliaryKey: ._valueUnsignedInt) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUnsignedInt, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .unsignedInt(valueUnsignedInt) + } + if let valueUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUri, auxiliaryKey: ._valueUri) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUri, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .uri(valueUri) + } + if let valueAddress = try Address(from: _container, forKeyIfPresent: .valueAddress) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAddress, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .address(valueAddress) + } + if let valueAge = try Age(from: _container, forKeyIfPresent: .valueAge) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAge, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .age(valueAge) + } + if let valueAnnotation = try Annotation(from: _container, forKeyIfPresent: .valueAnnotation) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAnnotation, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .annotation(valueAnnotation) + } + if let valueAttachment = try Attachment(from: _container, forKeyIfPresent: .valueAttachment) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAttachment, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .attachment(valueAttachment) + } + if let valueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .valueCodeableConcept) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .codeableConcept(valueCodeableConcept) + } + if let valueCoding = try Coding(from: _container, forKeyIfPresent: .valueCoding) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCoding, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .coding(valueCoding) + } + if let valueContactPoint = try ContactPoint(from: _container, forKeyIfPresent: .valueContactPoint) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueContactPoint, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .contactPoint(valueContactPoint) + } + if let valueCount = try Count(from: _container, forKeyIfPresent: .valueCount) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCount, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .count(valueCount) + } + if let valueDistance = try Distance(from: _container, forKeyIfPresent: .valueDistance) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDistance, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .distance(valueDistance) + } + if let valueDuration = try Duration(from: _container, forKeyIfPresent: .valueDuration) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDuration, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .duration(valueDuration) + } + if let valueHumanName = try HumanName(from: _container, forKeyIfPresent: .valueHumanName) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueHumanName, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .humanName(valueHumanName) + } + if let valueIdentifier = try Identifier(from: _container, forKeyIfPresent: .valueIdentifier) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueIdentifier, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .identifier(valueIdentifier) + } + if let valueMoney = try Money(from: _container, forKeyIfPresent: .valueMoney) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMoney, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .money(valueMoney) + } + if let valuePeriod = try Period(from: _container, forKeyIfPresent: .valuePeriod) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePeriod, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .period(valuePeriod) + } + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueRange = try Range(from: _container, forKeyIfPresent: .valueRange) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRange, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .range(valueRange) + } + if let valueRatio = try Ratio(from: _container, forKeyIfPresent: .valueRatio) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRatio, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .ratio(valueRatio) + } + if let valueReference = try Reference(from: _container, forKeyIfPresent: .valueReference) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueReference, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .reference(valueReference) + } + if let valueSampledData = try SampledData(from: _container, forKeyIfPresent: .valueSampledData) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSampledData, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .sampledData(valueSampledData) + } + if let valueSignature = try Signature(from: _container, forKeyIfPresent: .valueSignature) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSignature, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .signature(valueSignature) + } + if let valueTiming = try Timing(from: _container, forKeyIfPresent: .valueTiming) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTiming, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .timing(valueTiming) + } + if let valueMeta = try Meta(from: _container, forKeyIfPresent: .valueMeta) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMeta, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .meta(valueMeta) + } + self.value = _t_value! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try label.encode(on: &_container, forKey: .label, auxiliaryKey: ._label) + + switch value { + case .base64Binary(let _value): + try _value.encode(on: &_container, forKey: .valueBase64Binary, auxiliaryKey: ._valueBase64Binary) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .code(let _value): + try _value.encode(on: &_container, forKey: .valueCode, auxiliaryKey: ._valueCode) + case .date(let _value): + try _value.encode(on: &_container, forKey: .valueDate, auxiliaryKey: ._valueDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .valueDateTime, auxiliaryKey: ._valueDateTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .valueDecimal, auxiliaryKey: ._valueDecimal) + case .id(let _value): + try _value.encode(on: &_container, forKey: .valueId, auxiliaryKey: ._valueId) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .valueInstant, auxiliaryKey: ._valueInstant) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .valueInteger, auxiliaryKey: ._valueInteger) + case .markdown(let _value): + try _value.encode(on: &_container, forKey: .valueMarkdown, auxiliaryKey: ._valueMarkdown) + case .oid(let _value): + try _value.encode(on: &_container, forKey: .valueOid, auxiliaryKey: ._valueOid) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .valuePositiveInt, auxiliaryKey: ._valuePositiveInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .time(let _value): + try _value.encode(on: &_container, forKey: .valueTime, auxiliaryKey: ._valueTime) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .valueUnsignedInt, auxiliaryKey: ._valueUnsignedInt) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .valueUri, auxiliaryKey: ._valueUri) + case .address(let _value): + try _value.encode(on: &_container, forKey: .valueAddress) + case .age(let _value): + try _value.encode(on: &_container, forKey: .valueAge) + case .annotation(let _value): + try _value.encode(on: &_container, forKey: .valueAnnotation) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .valueAttachment) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .valueCodeableConcept) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .valueCoding) + case .contactPoint(let _value): + try _value.encode(on: &_container, forKey: .valueContactPoint) + case .count(let _value): + try _value.encode(on: &_container, forKey: .valueCount) + case .distance(let _value): + try _value.encode(on: &_container, forKey: .valueDistance) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .valueDuration) + case .humanName(let _value): + try _value.encode(on: &_container, forKey: .valueHumanName) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .valueIdentifier) + case .money(let _value): + try _value.encode(on: &_container, forKey: .valueMoney) + case .period(let _value): + try _value.encode(on: &_container, forKey: .valuePeriod) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .valueRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .valueRatio) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueReference) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .valueSampledData) + case .signature(let _value): + try _value.encode(on: &_container, forKey: .valueSignature) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .valueTiming) + case .meta(let _value): + try _value.encode(on: &_container, forKey: .valueMeta) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ElementDefinitionExample else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return label == _other.label + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(label) + hasher.combine(value) + } +} + +/** + Map element to another set of definitions. + + Identifies a concept from an external specification that roughly corresponds to this element. + */ +open class ElementDefinitionMapping: Element { + + /// Reference to mapping declaration + public var identity: FHIRPrimitive + + /// Computable language of mapping + public var language: FHIRPrimitive? + + /// Details of the mapping + public var map: FHIRPrimitive + + /// Comments about the mapping or its use + public var comment: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(identity: FHIRPrimitive, map: FHIRPrimitive) { + self.identity = identity + self.map = map + super.init() + } + + /// Convenience initializer + public convenience init( + comment: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identity: FHIRPrimitive, + language: FHIRPrimitive? = nil, + map: FHIRPrimitive) + { + self.init(identity: identity, map: map) + self.comment = comment + self.`extension` = `extension` + self.id = id + self.language = language + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case comment; case _comment + case identity; case _identity + case language; case _language + case map; case _map + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.identity = try FHIRPrimitive(from: _container, forKey: .identity, auxiliaryKey: ._identity) + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + self.map = try FHIRPrimitive(from: _container, forKey: .map, auxiliaryKey: ._map) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try identity.encode(on: &_container, forKey: .identity, auxiliaryKey: ._identity) + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try map.encode(on: &_container, forKey: .map, auxiliaryKey: ._map) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ElementDefinitionMapping else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return comment == _other.comment + && identity == _other.identity + && language == _other.language + && map == _other.map + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(comment) + hasher.combine(identity) + hasher.combine(language) + hasher.combine(map) + } +} + +/** + This element is sliced - slices follow. + + Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are + multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has + cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that + come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path + terminates the set). + */ +open class ElementDefinitionSlicing: Element { + + /// Element values that are used to distinguish the slices + public var discriminator: [ElementDefinitionSlicingDiscriminator]? + + /// Text description of how slicing works (or not) + public var description_fhir: FHIRPrimitive? + + /// If elements must be in same order as slices + public var ordered: FHIRPrimitive? + + /// Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that + /// additional slices are only allowed at the end. + public var rules: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(rules: FHIRPrimitive) { + self.rules = rules + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + discriminator: [ElementDefinitionSlicingDiscriminator]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + ordered: FHIRPrimitive? = nil, + rules: FHIRPrimitive) + { + self.init(rules: rules) + self.description_fhir = description_fhir + self.discriminator = discriminator + self.`extension` = `extension` + self.id = id + self.ordered = ordered + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case discriminator + case ordered; case _ordered + case rules; case _rules + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.discriminator = try [ElementDefinitionSlicingDiscriminator](from: _container, forKeyIfPresent: .discriminator) + self.ordered = try FHIRPrimitive(from: _container, forKeyIfPresent: .ordered, auxiliaryKey: ._ordered) + self.rules = try FHIRPrimitive(from: _container, forKey: .rules, auxiliaryKey: ._rules) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try discriminator?.encode(on: &_container, forKey: .discriminator) + try ordered?.encode(on: &_container, forKey: .ordered, auxiliaryKey: ._ordered) + try rules.encode(on: &_container, forKey: .rules, auxiliaryKey: ._rules) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ElementDefinitionSlicing else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && discriminator == _other.discriminator + && ordered == _other.ordered + && rules == _other.rules + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(discriminator) + hasher.combine(ordered) + hasher.combine(rules) + } +} + +/** + Element values that are used to distinguish the slices. + + Designates which child elements are used to discriminate between the slices when processing an instance. If one or more + discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which + slice the element in the resource matches based on the allowed values for those elements in each of the slices. + */ +open class ElementDefinitionSlicingDiscriminator: Element { + + /// How the element value is interpreted when discrimination is evaluated. + public var type: FHIRPrimitive + + /// Path to element value + public var path: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(path: FHIRPrimitive, type: FHIRPrimitive) { + self.path = path + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + path: FHIRPrimitive, + type: FHIRPrimitive) + { + self.init(path: path, type: type) + self.`extension` = `extension` + self.id = id + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case path; case _path + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.path = try FHIRPrimitive(from: _container, forKey: .path, auxiliaryKey: ._path) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try path.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ElementDefinitionSlicingDiscriminator else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return path == _other.path + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(path) + hasher.combine(type) + } +} + +/** + Data type and Profile for this element. + + The data type or resource that the value of this element is permitted to be. + */ +open class ElementDefinitionType: Element { + + /// Data type or Resource (reference to definition) + public var code: FHIRPrimitive + + /// Profile (StructureDefinition) to apply (or IG) + public var profile: FHIRPrimitive? + + /// Profile (StructureDefinition) to apply to reference target (or IG) + public var targetProfile: FHIRPrimitive? + + /// If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained + /// resource, or a reference, and if the context is a bundle, is it included in the bundle. + public var aggregation: [FHIRPrimitive]? + + /// Whether this reference needs to be version specific or version independent, or whether either can be used. + public var versioning: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + aggregation: [FHIRPrimitive]? = nil, + code: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + profile: FHIRPrimitive? = nil, + targetProfile: FHIRPrimitive? = nil, + versioning: FHIRPrimitive? = nil) + { + self.init(code: code) + self.aggregation = aggregation + self.`extension` = `extension` + self.id = id + self.profile = profile + self.targetProfile = targetProfile + self.versioning = versioning + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case aggregation; case _aggregation + case code; case _code + case profile; case _profile + case targetProfile; case _targetProfile + case versioning; case _versioning + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.aggregation = try [FHIRPrimitive](from: _container, forKeyIfPresent: .aggregation, auxiliaryKey: ._aggregation) + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.profile = try FHIRPrimitive(from: _container, forKeyIfPresent: .profile, auxiliaryKey: ._profile) + self.targetProfile = try FHIRPrimitive(from: _container, forKeyIfPresent: .targetProfile, auxiliaryKey: ._targetProfile) + self.versioning = try FHIRPrimitive(from: _container, forKeyIfPresent: .versioning, auxiliaryKey: ._versioning) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try aggregation?.encode(on: &_container, forKey: .aggregation, auxiliaryKey: ._aggregation) + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try profile?.encode(on: &_container, forKey: .profile, auxiliaryKey: ._profile) + try targetProfile?.encode(on: &_container, forKey: .targetProfile, auxiliaryKey: ._targetProfile) + try versioning?.encode(on: &_container, forKey: .versioning, auxiliaryKey: ._versioning) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ElementDefinitionType else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return aggregation == _other.aggregation + && code == _other.code + && profile == _other.profile + && targetProfile == _other.targetProfile + && versioning == _other.versioning + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(aggregation) + hasher.combine(code) + hasher.combine(profile) + hasher.combine(targetProfile) + hasher.combine(versioning) + } +} diff --git a/Sources/ModelsSTU3/EligibilityRequest.swift b/Sources/ModelsSTU3/EligibilityRequest.swift new file mode 100644 index 0000000..8a7a2e6 --- /dev/null +++ b/Sources/ModelsSTU3/EligibilityRequest.swift @@ -0,0 +1,273 @@ +// +// EligibilityRequest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/EligibilityRequest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Determine insurance validity and scope of coverage. + + The EligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in the + form of an EligibilityResponse, with information regarding whether the stated coverage is valid and in-force and + optionally to provide the insurance details of the policy. + */ +open class EligibilityRequest: DomainResource { + + override open class var resourceType: ResourceType { return .eligibilityRequest } + + /// All possible types for "serviced[x]" + public enum ServicedX: Hashable { + case date(FHIRPrimitive) + case period(Period) + } + + /// Business Identifier + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// Desired processing priority + public var priority: CodeableConcept? + + /// The subject of the Products and Services + public var patient: Reference? + + /// Estimated date or dates of Service + /// One of `serviced[x]` + public var serviced: ServicedX? + + /// Creation date + public var created: FHIRPrimitive? + + /// Author + public var enterer: Reference? + + /// Responsible practitioner + public var provider: Reference? + + /// Responsible organization + public var organization: Reference? + + /// Target + public var insurer: Reference? + + /// Servicing Facility + public var facility: Reference? + + /// Insurance or medical plan + public var coverage: Reference? + + /// Business agreement + public var businessArrangement: FHIRPrimitive? + + /// Type of services covered + public var benefitCategory: CodeableConcept? + + /// Detailed services covered within the type + public var benefitSubCategory: CodeableConcept? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + benefitCategory: CodeableConcept? = nil, + benefitSubCategory: CodeableConcept? = nil, + businessArrangement: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + coverage: Reference? = nil, + created: FHIRPrimitive? = nil, + enterer: Reference? = nil, + `extension`: [Extension]? = nil, + facility: Reference? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + insurer: Reference? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + organization: Reference? = nil, + patient: Reference? = nil, + priority: CodeableConcept? = nil, + provider: Reference? = nil, + serviced: ServicedX? = nil, + status: FHIRPrimitive? = nil, + text: Narrative? = nil) + { + self.init() + self.benefitCategory = benefitCategory + self.benefitSubCategory = benefitSubCategory + self.businessArrangement = businessArrangement + self.contained = contained + self.coverage = coverage + self.created = created + self.enterer = enterer + self.`extension` = `extension` + self.facility = facility + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.insurer = insurer + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.organization = organization + self.patient = patient + self.priority = priority + self.provider = provider + self.serviced = serviced + self.status = status + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case benefitCategory + case benefitSubCategory + case businessArrangement; case _businessArrangement + case coverage + case created; case _created + case enterer + case facility + case identifier + case insurer + case organization + case patient + case priority + case provider + case servicedDate; case _servicedDate + case servicedPeriod + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.benefitCategory = try CodeableConcept(from: _container, forKeyIfPresent: .benefitCategory) + self.benefitSubCategory = try CodeableConcept(from: _container, forKeyIfPresent: .benefitSubCategory) + self.businessArrangement = try FHIRPrimitive(from: _container, forKeyIfPresent: .businessArrangement, auxiliaryKey: ._businessArrangement) + self.coverage = try Reference(from: _container, forKeyIfPresent: .coverage) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.enterer = try Reference(from: _container, forKeyIfPresent: .enterer) + self.facility = try Reference(from: _container, forKeyIfPresent: .facility) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.insurer = try Reference(from: _container, forKeyIfPresent: .insurer) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.patient = try Reference(from: _container, forKeyIfPresent: .patient) + self.priority = try CodeableConcept(from: _container, forKeyIfPresent: .priority) + self.provider = try Reference(from: _container, forKeyIfPresent: .provider) + var _t_serviced: ServicedX? = nil + if let servicedDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .servicedDate, auxiliaryKey: ._servicedDate) { + if _t_serviced != nil { + throw DecodingError.dataCorruptedError(forKey: .servicedDate, in: _container, debugDescription: "More than one value provided for \"serviced\"") + } + _t_serviced = .date(servicedDate) + } + if let servicedPeriod = try Period(from: _container, forKeyIfPresent: .servicedPeriod) { + if _t_serviced != nil { + throw DecodingError.dataCorruptedError(forKey: .servicedPeriod, in: _container, debugDescription: "More than one value provided for \"serviced\"") + } + _t_serviced = .period(servicedPeriod) + } + self.serviced = _t_serviced + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try benefitCategory?.encode(on: &_container, forKey: .benefitCategory) + try benefitSubCategory?.encode(on: &_container, forKey: .benefitSubCategory) + try businessArrangement?.encode(on: &_container, forKey: .businessArrangement, auxiliaryKey: ._businessArrangement) + try coverage?.encode(on: &_container, forKey: .coverage) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try enterer?.encode(on: &_container, forKey: .enterer) + try facility?.encode(on: &_container, forKey: .facility) + try identifier?.encode(on: &_container, forKey: .identifier) + try insurer?.encode(on: &_container, forKey: .insurer) + try organization?.encode(on: &_container, forKey: .organization) + try patient?.encode(on: &_container, forKey: .patient) + try priority?.encode(on: &_container, forKey: .priority) + try provider?.encode(on: &_container, forKey: .provider) + if let _enum = serviced { + switch _enum { + case .date(let _value): + try _value.encode(on: &_container, forKey: .servicedDate, auxiliaryKey: ._servicedDate) + case .period(let _value): + try _value.encode(on: &_container, forKey: .servicedPeriod) + } + } + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EligibilityRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return benefitCategory == _other.benefitCategory + && benefitSubCategory == _other.benefitSubCategory + && businessArrangement == _other.businessArrangement + && coverage == _other.coverage + && created == _other.created + && enterer == _other.enterer + && facility == _other.facility + && identifier == _other.identifier + && insurer == _other.insurer + && organization == _other.organization + && patient == _other.patient + && priority == _other.priority + && provider == _other.provider + && serviced == _other.serviced + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(benefitCategory) + hasher.combine(benefitSubCategory) + hasher.combine(businessArrangement) + hasher.combine(coverage) + hasher.combine(created) + hasher.combine(enterer) + hasher.combine(facility) + hasher.combine(identifier) + hasher.combine(insurer) + hasher.combine(organization) + hasher.combine(patient) + hasher.combine(priority) + hasher.combine(provider) + hasher.combine(serviced) + hasher.combine(status) + } +} diff --git a/Sources/ModelsSTU3/EligibilityResponse.swift b/Sources/ModelsSTU3/EligibilityResponse.swift new file mode 100644 index 0000000..17db51a --- /dev/null +++ b/Sources/ModelsSTU3/EligibilityResponse.swift @@ -0,0 +1,694 @@ +// +// EligibilityResponse.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/EligibilityResponse) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + EligibilityResponse resource. + + This resource provides eligibility and plan details from the processing of an Eligibility resource. + */ +open class EligibilityResponse: DomainResource { + + override open class var resourceType: ResourceType { return .eligibilityResponse } + + /// Business Identifier + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// Creation date + public var created: FHIRPrimitive? + + /// Responsible practitioner + public var requestProvider: Reference? + + /// Responsible organization + public var requestOrganization: Reference? + + /// Eligibility reference + public var request: Reference? + + /// complete | error | partial + public var outcome: CodeableConcept? + + /// Disposition Message + public var disposition: FHIRPrimitive? + + /// Insurer issuing the coverage + public var insurer: Reference? + + /// Coverage inforce indicator + public var inforce: FHIRPrimitive? + + /// Details by insurance coverage + public var insurance: [EligibilityResponseInsurance]? + + /// Printed Form Identifier + public var form: CodeableConcept? + + /// Processing errors + public var error: [EligibilityResponseError]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + disposition: FHIRPrimitive? = nil, + error: [EligibilityResponseError]? = nil, + `extension`: [Extension]? = nil, + form: CodeableConcept? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + inforce: FHIRPrimitive? = nil, + insurance: [EligibilityResponseInsurance]? = nil, + insurer: Reference? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + outcome: CodeableConcept? = nil, + request: Reference? = nil, + requestOrganization: Reference? = nil, + requestProvider: Reference? = nil, + status: FHIRPrimitive? = nil, + text: Narrative? = nil) + { + self.init() + self.contained = contained + self.created = created + self.disposition = disposition + self.error = error + self.`extension` = `extension` + self.form = form + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.inforce = inforce + self.insurance = insurance + self.insurer = insurer + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.outcome = outcome + self.request = request + self.requestOrganization = requestOrganization + self.requestProvider = requestProvider + self.status = status + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case created; case _created + case disposition; case _disposition + case error + case form + case identifier + case inforce; case _inforce + case insurance + case insurer + case outcome + case request + case requestOrganization + case requestProvider + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.disposition = try FHIRPrimitive(from: _container, forKeyIfPresent: .disposition, auxiliaryKey: ._disposition) + self.error = try [EligibilityResponseError](from: _container, forKeyIfPresent: .error) + self.form = try CodeableConcept(from: _container, forKeyIfPresent: .form) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.inforce = try FHIRPrimitive(from: _container, forKeyIfPresent: .inforce, auxiliaryKey: ._inforce) + self.insurance = try [EligibilityResponseInsurance](from: _container, forKeyIfPresent: .insurance) + self.insurer = try Reference(from: _container, forKeyIfPresent: .insurer) + self.outcome = try CodeableConcept(from: _container, forKeyIfPresent: .outcome) + self.request = try Reference(from: _container, forKeyIfPresent: .request) + self.requestOrganization = try Reference(from: _container, forKeyIfPresent: .requestOrganization) + self.requestProvider = try Reference(from: _container, forKeyIfPresent: .requestProvider) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try disposition?.encode(on: &_container, forKey: .disposition, auxiliaryKey: ._disposition) + try error?.encode(on: &_container, forKey: .error) + try form?.encode(on: &_container, forKey: .form) + try identifier?.encode(on: &_container, forKey: .identifier) + try inforce?.encode(on: &_container, forKey: .inforce, auxiliaryKey: ._inforce) + try insurance?.encode(on: &_container, forKey: .insurance) + try insurer?.encode(on: &_container, forKey: .insurer) + try outcome?.encode(on: &_container, forKey: .outcome) + try request?.encode(on: &_container, forKey: .request) + try requestOrganization?.encode(on: &_container, forKey: .requestOrganization) + try requestProvider?.encode(on: &_container, forKey: .requestProvider) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EligibilityResponse else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return created == _other.created + && disposition == _other.disposition + && error == _other.error + && form == _other.form + && identifier == _other.identifier + && inforce == _other.inforce + && insurance == _other.insurance + && insurer == _other.insurer + && outcome == _other.outcome + && request == _other.request + && requestOrganization == _other.requestOrganization + && requestProvider == _other.requestProvider + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(created) + hasher.combine(disposition) + hasher.combine(error) + hasher.combine(form) + hasher.combine(identifier) + hasher.combine(inforce) + hasher.combine(insurance) + hasher.combine(insurer) + hasher.combine(outcome) + hasher.combine(request) + hasher.combine(requestOrganization) + hasher.combine(requestProvider) + hasher.combine(status) + } +} + +/** + Processing errors. + + Mutually exclusive with Services Provided (Item). + */ +open class EligibilityResponseError: BackboneElement { + + /// Error code detailing processing issues + public var code: CodeableConcept + + /// Designated initializer taking all required properties + public init(code: CodeableConcept) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(code: code) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKey: .code) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EligibilityResponseError else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + } +} + +/** + Details by insurance coverage. + + The insurer may provide both the details for the requested coverage as well as details for additional coverages known + to the insurer. + */ +open class EligibilityResponseInsurance: BackboneElement { + + /// Updated Coverage details + public var coverage: Reference? + + /// Contract details + public var contract: Reference? + + /// Benefits by Category + public var benefitBalance: [EligibilityResponseInsuranceBenefitBalance]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + benefitBalance: [EligibilityResponseInsuranceBenefitBalance]? = nil, + contract: Reference? = nil, + coverage: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.benefitBalance = benefitBalance + self.contract = contract + self.coverage = coverage + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case benefitBalance + case contract + case coverage + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.benefitBalance = try [EligibilityResponseInsuranceBenefitBalance](from: _container, forKeyIfPresent: .benefitBalance) + self.contract = try Reference(from: _container, forKeyIfPresent: .contract) + self.coverage = try Reference(from: _container, forKeyIfPresent: .coverage) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try benefitBalance?.encode(on: &_container, forKey: .benefitBalance) + try contract?.encode(on: &_container, forKey: .contract) + try coverage?.encode(on: &_container, forKey: .coverage) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EligibilityResponseInsurance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return benefitBalance == _other.benefitBalance + && contract == _other.contract + && coverage == _other.coverage + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(benefitBalance) + hasher.combine(contract) + hasher.combine(coverage) + } +} + +/** + Benefits by Category. + + Benefits and optionally current balances by Category. + */ +open class EligibilityResponseInsuranceBenefitBalance: BackboneElement { + + /// Type of services covered + public var category: CodeableConcept + + /// Detailed services covered within the type + public var subCategory: CodeableConcept? + + /// Excluded from the plan + public var excluded: FHIRPrimitive? + + /// Short name for the benefit + public var name: FHIRPrimitive? + + /// Description of the benefit or services covered + public var description_fhir: FHIRPrimitive? + + /// In or out of network + public var network: CodeableConcept? + + /// Individual or family + public var unit: CodeableConcept? + + /// Annual or lifetime + public var term: CodeableConcept? + + /// Benefit Summary + public var financial: [EligibilityResponseInsuranceBenefitBalanceFinancial]? + + /// Designated initializer taking all required properties + public init(category: CodeableConcept) { + self.category = category + super.init() + } + + /// Convenience initializer + public convenience init( + category: CodeableConcept, + description_fhir: FHIRPrimitive? = nil, + excluded: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + financial: [EligibilityResponseInsuranceBenefitBalanceFinancial]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + network: CodeableConcept? = nil, + subCategory: CodeableConcept? = nil, + term: CodeableConcept? = nil, + unit: CodeableConcept? = nil) + { + self.init(category: category) + self.description_fhir = description_fhir + self.excluded = excluded + self.`extension` = `extension` + self.financial = financial + self.id = id + self.modifierExtension = modifierExtension + self.name = name + self.network = network + self.subCategory = subCategory + self.term = term + self.unit = unit + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category + case description_fhir = "description"; case _description_fhir = "_description" + case excluded; case _excluded + case financial + case name; case _name + case network + case subCategory + case term + case unit + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try CodeableConcept(from: _container, forKey: .category) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.excluded = try FHIRPrimitive(from: _container, forKeyIfPresent: .excluded, auxiliaryKey: ._excluded) + self.financial = try [EligibilityResponseInsuranceBenefitBalanceFinancial](from: _container, forKeyIfPresent: .financial) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.network = try CodeableConcept(from: _container, forKeyIfPresent: .network) + self.subCategory = try CodeableConcept(from: _container, forKeyIfPresent: .subCategory) + self.term = try CodeableConcept(from: _container, forKeyIfPresent: .term) + self.unit = try CodeableConcept(from: _container, forKeyIfPresent: .unit) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category.encode(on: &_container, forKey: .category) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try excluded?.encode(on: &_container, forKey: .excluded, auxiliaryKey: ._excluded) + try financial?.encode(on: &_container, forKey: .financial) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try network?.encode(on: &_container, forKey: .network) + try subCategory?.encode(on: &_container, forKey: .subCategory) + try term?.encode(on: &_container, forKey: .term) + try unit?.encode(on: &_container, forKey: .unit) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EligibilityResponseInsuranceBenefitBalance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && description_fhir == _other.description_fhir + && excluded == _other.excluded + && financial == _other.financial + && name == _other.name + && network == _other.network + && subCategory == _other.subCategory + && term == _other.term + && unit == _other.unit + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(description_fhir) + hasher.combine(excluded) + hasher.combine(financial) + hasher.combine(name) + hasher.combine(network) + hasher.combine(subCategory) + hasher.combine(term) + hasher.combine(unit) + } +} + +/** + Benefit Summary. + + Benefits Used to date. + */ +open class EligibilityResponseInsuranceBenefitBalanceFinancial: BackboneElement { + + /// All possible types for "allowed[x]" + public enum AllowedX: Hashable { + case money(Money) + case string(FHIRPrimitive) + case unsignedInt(FHIRPrimitive) + } + + /// All possible types for "used[x]" + public enum UsedX: Hashable { + case money(Money) + case unsignedInt(FHIRPrimitive) + } + + /// Deductable, visits, benefit amount + public var type: CodeableConcept + + /// Benefits allowed + /// One of `allowed[x]` + public var allowed: AllowedX? + + /// Benefits used + /// One of `used[x]` + public var used: UsedX? + + /// Designated initializer taking all required properties + public init(type: CodeableConcept) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + allowed: AllowedX? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: CodeableConcept, + used: UsedX? = nil) + { + self.init(type: type) + self.allowed = allowed + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.used = used + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case allowedMoney + case allowedString; case _allowedString + case allowedUnsignedInt; case _allowedUnsignedInt + case type + case usedMoney + case usedUnsignedInt; case _usedUnsignedInt + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_allowed: AllowedX? = nil + if let allowedUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .allowedUnsignedInt, auxiliaryKey: ._allowedUnsignedInt) { + if _t_allowed != nil { + throw DecodingError.dataCorruptedError(forKey: .allowedUnsignedInt, in: _container, debugDescription: "More than one value provided for \"allowed\"") + } + _t_allowed = .unsignedInt(allowedUnsignedInt) + } + if let allowedString = try FHIRPrimitive(from: _container, forKeyIfPresent: .allowedString, auxiliaryKey: ._allowedString) { + if _t_allowed != nil { + throw DecodingError.dataCorruptedError(forKey: .allowedString, in: _container, debugDescription: "More than one value provided for \"allowed\"") + } + _t_allowed = .string(allowedString) + } + if let allowedMoney = try Money(from: _container, forKeyIfPresent: .allowedMoney) { + if _t_allowed != nil { + throw DecodingError.dataCorruptedError(forKey: .allowedMoney, in: _container, debugDescription: "More than one value provided for \"allowed\"") + } + _t_allowed = .money(allowedMoney) + } + self.allowed = _t_allowed + self.type = try CodeableConcept(from: _container, forKey: .type) + var _t_used: UsedX? = nil + if let usedUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .usedUnsignedInt, auxiliaryKey: ._usedUnsignedInt) { + if _t_used != nil { + throw DecodingError.dataCorruptedError(forKey: .usedUnsignedInt, in: _container, debugDescription: "More than one value provided for \"used\"") + } + _t_used = .unsignedInt(usedUnsignedInt) + } + if let usedMoney = try Money(from: _container, forKeyIfPresent: .usedMoney) { + if _t_used != nil { + throw DecodingError.dataCorruptedError(forKey: .usedMoney, in: _container, debugDescription: "More than one value provided for \"used\"") + } + _t_used = .money(usedMoney) + } + self.used = _t_used + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = allowed { + switch _enum { + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .allowedUnsignedInt, auxiliaryKey: ._allowedUnsignedInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .allowedString, auxiliaryKey: ._allowedString) + case .money(let _value): + try _value.encode(on: &_container, forKey: .allowedMoney) + } + } + try type.encode(on: &_container, forKey: .type) + if let _enum = used { + switch _enum { + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .usedUnsignedInt, auxiliaryKey: ._usedUnsignedInt) + case .money(let _value): + try _value.encode(on: &_container, forKey: .usedMoney) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EligibilityResponseInsuranceBenefitBalanceFinancial else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return allowed == _other.allowed + && type == _other.type + && used == _other.used + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(allowed) + hasher.combine(type) + hasher.combine(used) + } +} diff --git a/Sources/ModelsSTU3/Encounter.swift b/Sources/ModelsSTU3/Encounter.swift new file mode 100644 index 0000000..1919da2 --- /dev/null +++ b/Sources/ModelsSTU3/Encounter.swift @@ -0,0 +1,895 @@ +// +// Encounter.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Encounter) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + An interaction during which services are provided to the patient. + + An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or + assessing the health status of a patient. + */ +open class Encounter: DomainResource { + + override open class var resourceType: ResourceType { return .encounter } + + /// Identifier(s) by which this encounter is known + public var identifier: [Identifier]? + + /// None + public var status: FHIRPrimitive + + /// List of past encounter statuses + public var statusHistory: [EncounterStatusHistory]? + + /// inpatient | outpatient | ambulatory | emergency + + public var `class`: Coding? + + /// List of past encounter classes + public var classHistory: [EncounterClassHistory]? + + /// Specific type of encounter + public var type: [CodeableConcept]? + + /// Indicates the urgency of the encounter + public var priority: CodeableConcept? + + /// The patient ro group present at the encounter + public var subject: Reference? + + /// Episode(s) of care that this encounter should be recorded against + public var episodeOfCare: [Reference]? + + /// The ReferralRequest that initiated this encounter + public var incomingReferral: [Reference]? + + /// List of participants involved in the encounter + public var participant: [EncounterParticipant]? + + /// The appointment that scheduled this encounter + public var appointment: Reference? + + /// The start and end time of the encounter + public var period: Period? + + /// Quantity of time the encounter lasted (less time absent) + public var length: Duration? + + /// Reason the encounter takes place (code) + public var reason: [CodeableConcept]? + + /// The list of diagnosis relevant to this encounter + public var diagnosis: [EncounterDiagnosis]? + + /// The set of accounts that may be used for billing for this Encounter + public var account: [Reference]? + + /// Details about the admission to a healthcare service + public var hospitalization: EncounterHospitalization? + + /// List of locations where the patient has been + public var location: [EncounterLocation]? + + /// The custodian organization of this Encounter record + public var serviceProvider: Reference? + + /// Another Encounter this encounter is part of + public var partOf: Reference? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + account: [Reference]? = nil, + appointment: Reference? = nil, + `class`: Coding? = nil, + classHistory: [EncounterClassHistory]? = nil, + contained: [ResourceProxy]? = nil, + diagnosis: [EncounterDiagnosis]? = nil, + episodeOfCare: [Reference]? = nil, + `extension`: [Extension]? = nil, + hospitalization: EncounterHospitalization? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + incomingReferral: [Reference]? = nil, + language: FHIRPrimitive? = nil, + length: Duration? = nil, + location: [EncounterLocation]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + partOf: Reference? = nil, + participant: [EncounterParticipant]? = nil, + period: Period? = nil, + priority: CodeableConcept? = nil, + reason: [CodeableConcept]? = nil, + serviceProvider: Reference? = nil, + status: FHIRPrimitive, + statusHistory: [EncounterStatusHistory]? = nil, + subject: Reference? = nil, + text: Narrative? = nil, + type: [CodeableConcept]? = nil) + { + self.init(status: status) + self.account = account + self.appointment = appointment + self.`class` = `class` + self.classHistory = classHistory + self.contained = contained + self.diagnosis = diagnosis + self.episodeOfCare = episodeOfCare + self.`extension` = `extension` + self.hospitalization = hospitalization + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.incomingReferral = incomingReferral + self.language = language + self.length = length + self.location = location + self.meta = meta + self.modifierExtension = modifierExtension + self.partOf = partOf + self.participant = participant + self.period = period + self.priority = priority + self.reason = reason + self.serviceProvider = serviceProvider + self.statusHistory = statusHistory + self.subject = subject + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case account + case appointment + case `class` = "class" + case classHistory + case diagnosis + case episodeOfCare + case hospitalization + case identifier + case incomingReferral + case length + case location + case partOf + case participant + case period + case priority + case reason + case serviceProvider + case status; case _status + case statusHistory + case subject + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.account = try [Reference](from: _container, forKeyIfPresent: .account) + self.appointment = try Reference(from: _container, forKeyIfPresent: .appointment) + self.`class` = try Coding(from: _container, forKeyIfPresent: .`class`) + self.classHistory = try [EncounterClassHistory](from: _container, forKeyIfPresent: .classHistory) + self.diagnosis = try [EncounterDiagnosis](from: _container, forKeyIfPresent: .diagnosis) + self.episodeOfCare = try [Reference](from: _container, forKeyIfPresent: .episodeOfCare) + self.hospitalization = try EncounterHospitalization(from: _container, forKeyIfPresent: .hospitalization) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.incomingReferral = try [Reference](from: _container, forKeyIfPresent: .incomingReferral) + self.length = try Duration(from: _container, forKeyIfPresent: .length) + self.location = try [EncounterLocation](from: _container, forKeyIfPresent: .location) + self.partOf = try Reference(from: _container, forKeyIfPresent: .partOf) + self.participant = try [EncounterParticipant](from: _container, forKeyIfPresent: .participant) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.priority = try CodeableConcept(from: _container, forKeyIfPresent: .priority) + self.reason = try [CodeableConcept](from: _container, forKeyIfPresent: .reason) + self.serviceProvider = try Reference(from: _container, forKeyIfPresent: .serviceProvider) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.statusHistory = try [EncounterStatusHistory](from: _container, forKeyIfPresent: .statusHistory) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.type = try [CodeableConcept](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try account?.encode(on: &_container, forKey: .account) + try appointment?.encode(on: &_container, forKey: .appointment) + try `class`?.encode(on: &_container, forKey: .`class`) + try classHistory?.encode(on: &_container, forKey: .classHistory) + try diagnosis?.encode(on: &_container, forKey: .diagnosis) + try episodeOfCare?.encode(on: &_container, forKey: .episodeOfCare) + try hospitalization?.encode(on: &_container, forKey: .hospitalization) + try identifier?.encode(on: &_container, forKey: .identifier) + try incomingReferral?.encode(on: &_container, forKey: .incomingReferral) + try length?.encode(on: &_container, forKey: .length) + try location?.encode(on: &_container, forKey: .location) + try partOf?.encode(on: &_container, forKey: .partOf) + try participant?.encode(on: &_container, forKey: .participant) + try period?.encode(on: &_container, forKey: .period) + try priority?.encode(on: &_container, forKey: .priority) + try reason?.encode(on: &_container, forKey: .reason) + try serviceProvider?.encode(on: &_container, forKey: .serviceProvider) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try statusHistory?.encode(on: &_container, forKey: .statusHistory) + try subject?.encode(on: &_container, forKey: .subject) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Encounter else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return account == _other.account + && appointment == _other.appointment + && `class` == _other.`class` + && classHistory == _other.classHistory + && diagnosis == _other.diagnosis + && episodeOfCare == _other.episodeOfCare + && hospitalization == _other.hospitalization + && identifier == _other.identifier + && incomingReferral == _other.incomingReferral + && length == _other.length + && location == _other.location + && partOf == _other.partOf + && participant == _other.participant + && period == _other.period + && priority == _other.priority + && reason == _other.reason + && serviceProvider == _other.serviceProvider + && status == _other.status + && statusHistory == _other.statusHistory + && subject == _other.subject + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(account) + hasher.combine(appointment) + hasher.combine(`class`) + hasher.combine(classHistory) + hasher.combine(diagnosis) + hasher.combine(episodeOfCare) + hasher.combine(hospitalization) + hasher.combine(identifier) + hasher.combine(incomingReferral) + hasher.combine(length) + hasher.combine(location) + hasher.combine(partOf) + hasher.combine(participant) + hasher.combine(period) + hasher.combine(priority) + hasher.combine(reason) + hasher.combine(serviceProvider) + hasher.combine(status) + hasher.combine(statusHistory) + hasher.combine(subject) + hasher.combine(type) + } +} + +/** + List of past encounter classes. + + The class history permits the tracking of the encounters transitions without needing to go through the resource + history. + + This would be used for a case where an admission starts of as an emergency encounter, then transisions into an + inpatient scenario. Doing this and not restarting a new encounter ensures that any lab/diagnostic results can more + easily follow the patient and not require re-processing and not get lost or cancelled during a kindof discharge from + emergency to inpatient. + */ +open class EncounterClassHistory: BackboneElement { + + /// inpatient | outpatient | ambulatory | emergency + + public var `class`: Coding + + /// The time that the episode was in the specified class + public var period: Period + + /// Designated initializer taking all required properties + public init(`class`: Coding, period: Period) { + self.`class` = `class` + self.period = period + super.init() + } + + /// Convenience initializer + public convenience init( + `class`: Coding, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + period: Period) + { + self.init(class: `class`, period: period) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case `class` = "class" + case period + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.`class` = try Coding(from: _container, forKey: .`class`) + self.period = try Period(from: _container, forKey: .period) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try `class`.encode(on: &_container, forKey: .`class`) + try period.encode(on: &_container, forKey: .period) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EncounterClassHistory else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return `class` == _other.`class` + && period == _other.period + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(`class`) + hasher.combine(period) + } +} + +/** + The list of diagnosis relevant to this encounter. + */ +open class EncounterDiagnosis: BackboneElement { + + /// Reason the encounter takes place (resource) + public var condition: Reference + + /// Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …) + public var role: CodeableConcept? + + /// Ranking of the diagnosis (for each role type) + public var rank: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(condition: Reference) { + self.condition = condition + super.init() + } + + /// Convenience initializer + public convenience init( + condition: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + rank: FHIRPrimitive? = nil, + role: CodeableConcept? = nil) + { + self.init(condition: condition) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.rank = rank + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case condition + case rank; case _rank + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.condition = try Reference(from: _container, forKey: .condition) + self.rank = try FHIRPrimitive(from: _container, forKeyIfPresent: .rank, auxiliaryKey: ._rank) + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try condition.encode(on: &_container, forKey: .condition) + try rank?.encode(on: &_container, forKey: .rank, auxiliaryKey: ._rank) + try role?.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EncounterDiagnosis else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return condition == _other.condition + && rank == _other.rank + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(condition) + hasher.combine(rank) + hasher.combine(role) + } +} + +/** + Details about the admission to a healthcare service. + */ +open class EncounterHospitalization: BackboneElement { + + /// Pre-admission identifier + public var preAdmissionIdentifier: Identifier? + + /// The location from which the patient came before admission + public var origin: Reference? + + /// From where patient was admitted (physician referral, transfer) + public var admitSource: CodeableConcept? + + /// The type of hospital re-admission that has occurred (if any). If the value is absent, then this is not + /// identified as a readmission + public var reAdmission: CodeableConcept? + + /// Diet preferences reported by the patient + public var dietPreference: [CodeableConcept]? + + /// Special courtesies (VIP, board member) + public var specialCourtesy: [CodeableConcept]? + + /// Wheelchair, translator, stretcher, etc. + public var specialArrangement: [CodeableConcept]? + + /// Location to which the patient is discharged + public var destination: Reference? + + /// Category or kind of location after discharge + public var dischargeDisposition: CodeableConcept? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + admitSource: CodeableConcept? = nil, + destination: Reference? = nil, + dietPreference: [CodeableConcept]? = nil, + dischargeDisposition: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + origin: Reference? = nil, + preAdmissionIdentifier: Identifier? = nil, + reAdmission: CodeableConcept? = nil, + specialArrangement: [CodeableConcept]? = nil, + specialCourtesy: [CodeableConcept]? = nil) + { + self.init() + self.admitSource = admitSource + self.destination = destination + self.dietPreference = dietPreference + self.dischargeDisposition = dischargeDisposition + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.origin = origin + self.preAdmissionIdentifier = preAdmissionIdentifier + self.reAdmission = reAdmission + self.specialArrangement = specialArrangement + self.specialCourtesy = specialCourtesy + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case admitSource + case destination + case dietPreference + case dischargeDisposition + case origin + case preAdmissionIdentifier + case reAdmission + case specialArrangement + case specialCourtesy + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.admitSource = try CodeableConcept(from: _container, forKeyIfPresent: .admitSource) + self.destination = try Reference(from: _container, forKeyIfPresent: .destination) + self.dietPreference = try [CodeableConcept](from: _container, forKeyIfPresent: .dietPreference) + self.dischargeDisposition = try CodeableConcept(from: _container, forKeyIfPresent: .dischargeDisposition) + self.origin = try Reference(from: _container, forKeyIfPresent: .origin) + self.preAdmissionIdentifier = try Identifier(from: _container, forKeyIfPresent: .preAdmissionIdentifier) + self.reAdmission = try CodeableConcept(from: _container, forKeyIfPresent: .reAdmission) + self.specialArrangement = try [CodeableConcept](from: _container, forKeyIfPresent: .specialArrangement) + self.specialCourtesy = try [CodeableConcept](from: _container, forKeyIfPresent: .specialCourtesy) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try admitSource?.encode(on: &_container, forKey: .admitSource) + try destination?.encode(on: &_container, forKey: .destination) + try dietPreference?.encode(on: &_container, forKey: .dietPreference) + try dischargeDisposition?.encode(on: &_container, forKey: .dischargeDisposition) + try origin?.encode(on: &_container, forKey: .origin) + try preAdmissionIdentifier?.encode(on: &_container, forKey: .preAdmissionIdentifier) + try reAdmission?.encode(on: &_container, forKey: .reAdmission) + try specialArrangement?.encode(on: &_container, forKey: .specialArrangement) + try specialCourtesy?.encode(on: &_container, forKey: .specialCourtesy) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EncounterHospitalization else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return admitSource == _other.admitSource + && destination == _other.destination + && dietPreference == _other.dietPreference + && dischargeDisposition == _other.dischargeDisposition + && origin == _other.origin + && preAdmissionIdentifier == _other.preAdmissionIdentifier + && reAdmission == _other.reAdmission + && specialArrangement == _other.specialArrangement + && specialCourtesy == _other.specialCourtesy + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(admitSource) + hasher.combine(destination) + hasher.combine(dietPreference) + hasher.combine(dischargeDisposition) + hasher.combine(origin) + hasher.combine(preAdmissionIdentifier) + hasher.combine(reAdmission) + hasher.combine(specialArrangement) + hasher.combine(specialCourtesy) + } +} + +/** + List of locations where the patient has been. + + List of locations where the patient has been during this encounter. + */ +open class EncounterLocation: BackboneElement { + + /// Location the encounter takes place + public var location: Reference + + /// The status of the participants' presence at the specified location during the period specified. If the + /// participant is is no longer at the location, then the period will have an end date/time. + public var status: FHIRPrimitive? + + /// Time period during which the patient was present at the location + public var period: Period? + + /// Designated initializer taking all required properties + public init(location: Reference) { + self.location = location + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + location: Reference, + modifierExtension: [Extension]? = nil, + period: Period? = nil, + status: FHIRPrimitive? = nil) + { + self.init(location: location) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.period = period + self.status = status + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case location + case period + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.location = try Reference(from: _container, forKey: .location) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try location.encode(on: &_container, forKey: .location) + try period?.encode(on: &_container, forKey: .period) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EncounterLocation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return location == _other.location + && period == _other.period + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(location) + hasher.combine(period) + hasher.combine(status) + } +} + +/** + List of participants involved in the encounter. + + The list of people responsible for providing the service. + */ +open class EncounterParticipant: BackboneElement { + + /// Role of participant in encounter + public var type: [CodeableConcept]? + + /// Period of time during the encounter that the participant participated + public var period: Period? + + /// Persons involved in the encounter other than the patient + public var individual: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + individual: Reference? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil, + type: [CodeableConcept]? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.individual = individual + self.modifierExtension = modifierExtension + self.period = period + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case individual + case period + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.individual = try Reference(from: _container, forKeyIfPresent: .individual) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.type = try [CodeableConcept](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try individual?.encode(on: &_container, forKey: .individual) + try period?.encode(on: &_container, forKey: .period) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EncounterParticipant else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return individual == _other.individual + && period == _other.period + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(individual) + hasher.combine(period) + hasher.combine(type) + } +} + +/** + List of past encounter statuses. + + The status history permits the encounter resource to contain the status history without needing to read through the + historical versions of the resource, or even have the server store them. + */ +open class EncounterStatusHistory: BackboneElement { + + /// None + public var status: FHIRPrimitive + + /// The time that the episode was in the specified status + public var period: Period + + /// Designated initializer taking all required properties + public init(period: Period, status: FHIRPrimitive) { + self.period = period + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + period: Period, + status: FHIRPrimitive) + { + self.init(period: period, status: status) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case period + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.period = try Period(from: _container, forKey: .period) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try period.encode(on: &_container, forKey: .period) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EncounterStatusHistory else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return period == _other.period + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(period) + hasher.combine(status) + } +} diff --git a/Sources/ModelsSTU3/Endpoint.swift b/Sources/ModelsSTU3/Endpoint.swift new file mode 100644 index 0000000..f70f28d --- /dev/null +++ b/Sources/ModelsSTU3/Endpoint.swift @@ -0,0 +1,205 @@ +// +// Endpoint.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Endpoint) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The technical details of an endpoint that can be used for electronic services. + + The technical details of an endpoint that can be used for electronic services, such as for web services providing XDS.b + or a REST endpoint for another FHIR server. This may include any security context information. + */ +open class Endpoint: DomainResource { + + override open class var resourceType: ResourceType { return .endpoint } + + /// Identifies this endpoint across multiple systems + public var identifier: [Identifier]? + + /// active | suspended | error | off | test. + public var status: FHIRPrimitive + + /// Protocol/Profile/Standard to be used with this endpoint connection + public var connectionType: Coding + + /// A name that this endpoint can be identified by + public var name: FHIRPrimitive? + + /// Organization that manages this endpoint (may not be the organization that exposes the endpoint) + public var managingOrganization: Reference? + + /// Contact details for source (e.g. troubleshooting) + public var contact: [ContactPoint]? + + /// Interval the endpoint is expected to be operational + public var period: Period? + + /// The type of content that may be used at this endpoint (e.g. XDS Discharge summaries) + public var payloadType: [CodeableConcept] + + /// Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType + /// defined this) + public var payloadMimeType: [FHIRPrimitive]? + + /// The technical base address for connecting to this endpoint + public var address: FHIRPrimitive + + /// Usage depends on the channel type + public var header: [FHIRPrimitive]? + + /// Designated initializer taking all required properties + public init(address: FHIRPrimitive, connectionType: Coding, payloadType: [CodeableConcept], status: FHIRPrimitive) { + self.address = address + self.connectionType = connectionType + self.payloadType = payloadType + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + address: FHIRPrimitive, + connectionType: Coding, + contact: [ContactPoint]? = nil, + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + header: [FHIRPrimitive]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + managingOrganization: Reference? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + payloadMimeType: [FHIRPrimitive]? = nil, + payloadType: [CodeableConcept], + period: Period? = nil, + status: FHIRPrimitive, + text: Narrative? = nil) + { + self.init(address: address, connectionType: connectionType, payloadType: payloadType, status: status) + self.contact = contact + self.contained = contained + self.`extension` = `extension` + self.header = header + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.managingOrganization = managingOrganization + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.payloadMimeType = payloadMimeType + self.period = period + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case address; case _address + case connectionType + case contact + case header; case _header + case identifier + case managingOrganization + case name; case _name + case payloadMimeType; case _payloadMimeType + case payloadType + case period + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.address = try FHIRPrimitive(from: _container, forKey: .address, auxiliaryKey: ._address) + self.connectionType = try Coding(from: _container, forKey: .connectionType) + self.contact = try [ContactPoint](from: _container, forKeyIfPresent: .contact) + self.header = try [FHIRPrimitive](from: _container, forKeyIfPresent: .header, auxiliaryKey: ._header) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.managingOrganization = try Reference(from: _container, forKeyIfPresent: .managingOrganization) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.payloadMimeType = try [FHIRPrimitive](from: _container, forKeyIfPresent: .payloadMimeType, auxiliaryKey: ._payloadMimeType) + self.payloadType = try [CodeableConcept](from: _container, forKey: .payloadType) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try address.encode(on: &_container, forKey: .address, auxiliaryKey: ._address) + try connectionType.encode(on: &_container, forKey: .connectionType) + try contact?.encode(on: &_container, forKey: .contact) + try header?.encode(on: &_container, forKey: .header, auxiliaryKey: ._header) + try identifier?.encode(on: &_container, forKey: .identifier) + try managingOrganization?.encode(on: &_container, forKey: .managingOrganization) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try payloadMimeType?.encode(on: &_container, forKey: .payloadMimeType, auxiliaryKey: ._payloadMimeType) + try payloadType.encode(on: &_container, forKey: .payloadType) + try period?.encode(on: &_container, forKey: .period) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Endpoint else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return address == _other.address + && connectionType == _other.connectionType + && contact == _other.contact + && header == _other.header + && identifier == _other.identifier + && managingOrganization == _other.managingOrganization + && name == _other.name + && payloadMimeType == _other.payloadMimeType + && payloadType == _other.payloadType + && period == _other.period + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(address) + hasher.combine(connectionType) + hasher.combine(contact) + hasher.combine(header) + hasher.combine(identifier) + hasher.combine(managingOrganization) + hasher.combine(name) + hasher.combine(payloadMimeType) + hasher.combine(payloadType) + hasher.combine(period) + hasher.combine(status) + } +} diff --git a/Sources/ModelsSTU3/EnrollmentRequest.swift b/Sources/ModelsSTU3/EnrollmentRequest.swift new file mode 100644 index 0000000..643c488 --- /dev/null +++ b/Sources/ModelsSTU3/EnrollmentRequest.swift @@ -0,0 +1,173 @@ +// +// EnrollmentRequest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Enrollment request. + + This resource provides the insurance enrollment details to the insurer regarding a specified coverage. + */ +open class EnrollmentRequest: DomainResource { + + override open class var resourceType: ResourceType { return .enrollmentRequest } + + /// Business Identifier + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// Creation date + public var created: FHIRPrimitive? + + /// Target + public var insurer: Reference? + + /// Responsible practitioner + public var provider: Reference? + + /// Responsible organization + public var organization: Reference? + + /// The subject of the Products and Services + public var subject: Reference? + + /// Insurance information + public var coverage: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + coverage: Reference? = nil, + created: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + insurer: Reference? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + organization: Reference? = nil, + provider: Reference? = nil, + status: FHIRPrimitive? = nil, + subject: Reference? = nil, + text: Narrative? = nil) + { + self.init() + self.contained = contained + self.coverage = coverage + self.created = created + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.insurer = insurer + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.organization = organization + self.provider = provider + self.status = status + self.subject = subject + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case coverage + case created; case _created + case identifier + case insurer + case organization + case provider + case status; case _status + case subject + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.coverage = try Reference(from: _container, forKeyIfPresent: .coverage) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.insurer = try Reference(from: _container, forKeyIfPresent: .insurer) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.provider = try Reference(from: _container, forKeyIfPresent: .provider) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try coverage?.encode(on: &_container, forKey: .coverage) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try identifier?.encode(on: &_container, forKey: .identifier) + try insurer?.encode(on: &_container, forKey: .insurer) + try organization?.encode(on: &_container, forKey: .organization) + try provider?.encode(on: &_container, forKey: .provider) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EnrollmentRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return coverage == _other.coverage + && created == _other.created + && identifier == _other.identifier + && insurer == _other.insurer + && organization == _other.organization + && provider == _other.provider + && status == _other.status + && subject == _other.subject + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(coverage) + hasher.combine(created) + hasher.combine(identifier) + hasher.combine(insurer) + hasher.combine(organization) + hasher.combine(provider) + hasher.combine(status) + hasher.combine(subject) + } +} diff --git a/Sources/ModelsSTU3/EnrollmentResponse.swift b/Sources/ModelsSTU3/EnrollmentResponse.swift new file mode 100644 index 0000000..14d39ff --- /dev/null +++ b/Sources/ModelsSTU3/EnrollmentResponse.swift @@ -0,0 +1,183 @@ +// +// EnrollmentResponse.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + EnrollmentResponse resource. + + This resource provides enrollment and plan details from the processing of an Enrollment resource. + */ +open class EnrollmentResponse: DomainResource { + + override open class var resourceType: ResourceType { return .enrollmentResponse } + + /// Business Identifier + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// Claim reference + public var request: Reference? + + /// complete | error | partial + public var outcome: CodeableConcept? + + /// Disposition Message + public var disposition: FHIRPrimitive? + + /// Creation date + public var created: FHIRPrimitive? + + /// Insurer + public var organization: Reference? + + /// Responsible practitioner + public var requestProvider: Reference? + + /// Responsible organization + public var requestOrganization: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + disposition: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + organization: Reference? = nil, + outcome: CodeableConcept? = nil, + request: Reference? = nil, + requestOrganization: Reference? = nil, + requestProvider: Reference? = nil, + status: FHIRPrimitive? = nil, + text: Narrative? = nil) + { + self.init() + self.contained = contained + self.created = created + self.disposition = disposition + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.organization = organization + self.outcome = outcome + self.request = request + self.requestOrganization = requestOrganization + self.requestProvider = requestProvider + self.status = status + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case created; case _created + case disposition; case _disposition + case identifier + case organization + case outcome + case request + case requestOrganization + case requestProvider + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.disposition = try FHIRPrimitive(from: _container, forKeyIfPresent: .disposition, auxiliaryKey: ._disposition) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.outcome = try CodeableConcept(from: _container, forKeyIfPresent: .outcome) + self.request = try Reference(from: _container, forKeyIfPresent: .request) + self.requestOrganization = try Reference(from: _container, forKeyIfPresent: .requestOrganization) + self.requestProvider = try Reference(from: _container, forKeyIfPresent: .requestProvider) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try disposition?.encode(on: &_container, forKey: .disposition, auxiliaryKey: ._disposition) + try identifier?.encode(on: &_container, forKey: .identifier) + try organization?.encode(on: &_container, forKey: .organization) + try outcome?.encode(on: &_container, forKey: .outcome) + try request?.encode(on: &_container, forKey: .request) + try requestOrganization?.encode(on: &_container, forKey: .requestOrganization) + try requestProvider?.encode(on: &_container, forKey: .requestProvider) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EnrollmentResponse else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return created == _other.created + && disposition == _other.disposition + && identifier == _other.identifier + && organization == _other.organization + && outcome == _other.outcome + && request == _other.request + && requestOrganization == _other.requestOrganization + && requestProvider == _other.requestProvider + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(created) + hasher.combine(disposition) + hasher.combine(identifier) + hasher.combine(organization) + hasher.combine(outcome) + hasher.combine(request) + hasher.combine(requestOrganization) + hasher.combine(requestProvider) + hasher.combine(status) + } +} diff --git a/Sources/ModelsSTU3/EpisodeOfCare.swift b/Sources/ModelsSTU3/EpisodeOfCare.swift new file mode 100644 index 0000000..fcd8705 --- /dev/null +++ b/Sources/ModelsSTU3/EpisodeOfCare.swift @@ -0,0 +1,386 @@ +// +// EpisodeOfCare.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + An association of a Patient with an Organization and Healthcare Provider(s) for a period of time that the Organization + assumes some level of responsibility. + + An association between a patient and an organization / healthcare provider(s) during which time encounters may occur. + The managing organization assumes a level of responsibility for the patient during this time. + */ +open class EpisodeOfCare: DomainResource { + + override open class var resourceType: ResourceType { return .episodeOfCare } + + /// Business Identifier(s) relevant for this EpisodeOfCare + public var identifier: [Identifier]? + + /// planned | waitlist | active | onhold | finished | cancelled. + public var status: FHIRPrimitive + + /// Past list of status codes (the current status may be included to cover the start date of the status) + public var statusHistory: [EpisodeOfCareStatusHistory]? + + /// Type/class - e.g. specialist referral, disease management + public var type: [CodeableConcept]? + + /// The list of diagnosis relevant to this episode of care + public var diagnosis: [EpisodeOfCareDiagnosis]? + + /// The patient who is the focus of this episode of care + public var patient: Reference + + /// Organization that assumes care + public var managingOrganization: Reference? + + /// Interval during responsibility is assumed + public var period: Period? + + /// Originating Referral Request(s) + public var referralRequest: [Reference]? + + /// Care manager/care co-ordinator for the patient + public var careManager: Reference? + + /// Other practitioners facilitating this episode of care + public var team: [Reference]? + + /// The set of accounts that may be used for billing for this EpisodeOfCare + public var account: [Reference]? + + /// Designated initializer taking all required properties + public init(patient: Reference, status: FHIRPrimitive) { + self.patient = patient + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + account: [Reference]? = nil, + careManager: Reference? = nil, + contained: [ResourceProxy]? = nil, + diagnosis: [EpisodeOfCareDiagnosis]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + managingOrganization: Reference? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + patient: Reference, + period: Period? = nil, + referralRequest: [Reference]? = nil, + status: FHIRPrimitive, + statusHistory: [EpisodeOfCareStatusHistory]? = nil, + team: [Reference]? = nil, + text: Narrative? = nil, + type: [CodeableConcept]? = nil) + { + self.init(patient: patient, status: status) + self.account = account + self.careManager = careManager + self.contained = contained + self.diagnosis = diagnosis + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.managingOrganization = managingOrganization + self.meta = meta + self.modifierExtension = modifierExtension + self.period = period + self.referralRequest = referralRequest + self.statusHistory = statusHistory + self.team = team + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case account + case careManager + case diagnosis + case identifier + case managingOrganization + case patient + case period + case referralRequest + case status; case _status + case statusHistory + case team + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.account = try [Reference](from: _container, forKeyIfPresent: .account) + self.careManager = try Reference(from: _container, forKeyIfPresent: .careManager) + self.diagnosis = try [EpisodeOfCareDiagnosis](from: _container, forKeyIfPresent: .diagnosis) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.managingOrganization = try Reference(from: _container, forKeyIfPresent: .managingOrganization) + self.patient = try Reference(from: _container, forKey: .patient) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.referralRequest = try [Reference](from: _container, forKeyIfPresent: .referralRequest) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.statusHistory = try [EpisodeOfCareStatusHistory](from: _container, forKeyIfPresent: .statusHistory) + self.team = try [Reference](from: _container, forKeyIfPresent: .team) + self.type = try [CodeableConcept](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try account?.encode(on: &_container, forKey: .account) + try careManager?.encode(on: &_container, forKey: .careManager) + try diagnosis?.encode(on: &_container, forKey: .diagnosis) + try identifier?.encode(on: &_container, forKey: .identifier) + try managingOrganization?.encode(on: &_container, forKey: .managingOrganization) + try patient.encode(on: &_container, forKey: .patient) + try period?.encode(on: &_container, forKey: .period) + try referralRequest?.encode(on: &_container, forKey: .referralRequest) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try statusHistory?.encode(on: &_container, forKey: .statusHistory) + try team?.encode(on: &_container, forKey: .team) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EpisodeOfCare else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return account == _other.account + && careManager == _other.careManager + && diagnosis == _other.diagnosis + && identifier == _other.identifier + && managingOrganization == _other.managingOrganization + && patient == _other.patient + && period == _other.period + && referralRequest == _other.referralRequest + && status == _other.status + && statusHistory == _other.statusHistory + && team == _other.team + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(account) + hasher.combine(careManager) + hasher.combine(diagnosis) + hasher.combine(identifier) + hasher.combine(managingOrganization) + hasher.combine(patient) + hasher.combine(period) + hasher.combine(referralRequest) + hasher.combine(status) + hasher.combine(statusHistory) + hasher.combine(team) + hasher.combine(type) + } +} + +/** + The list of diagnosis relevant to this episode of care. + */ +open class EpisodeOfCareDiagnosis: BackboneElement { + + /// Conditions/problems/diagnoses this episode of care is for + public var condition: Reference + + /// Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …) + public var role: CodeableConcept? + + /// Ranking of the diagnosis (for each role type) + public var rank: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(condition: Reference) { + self.condition = condition + super.init() + } + + /// Convenience initializer + public convenience init( + condition: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + rank: FHIRPrimitive? = nil, + role: CodeableConcept? = nil) + { + self.init(condition: condition) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.rank = rank + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case condition + case rank; case _rank + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.condition = try Reference(from: _container, forKey: .condition) + self.rank = try FHIRPrimitive(from: _container, forKeyIfPresent: .rank, auxiliaryKey: ._rank) + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try condition.encode(on: &_container, forKey: .condition) + try rank?.encode(on: &_container, forKey: .rank, auxiliaryKey: ._rank) + try role?.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EpisodeOfCareDiagnosis else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return condition == _other.condition + && rank == _other.rank + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(condition) + hasher.combine(rank) + hasher.combine(role) + } +} + +/** + Past list of status codes (the current status may be included to cover the start date of the status). + + The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the + resource). + */ +open class EpisodeOfCareStatusHistory: BackboneElement { + + /// planned | waitlist | active | onhold | finished | cancelled. + public var status: FHIRPrimitive + + /// Duration the EpisodeOfCare was in the specified status + public var period: Period + + /// Designated initializer taking all required properties + public init(period: Period, status: FHIRPrimitive) { + self.period = period + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + period: Period, + status: FHIRPrimitive) + { + self.init(period: period, status: status) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case period + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.period = try Period(from: _container, forKey: .period) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try period.encode(on: &_container, forKey: .period) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? EpisodeOfCareStatusHistory else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return period == _other.period + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(period) + hasher.combine(status) + } +} diff --git a/Sources/ModelsSTU3/ExpansionProfile.swift b/Sources/ModelsSTU3/ExpansionProfile.swift new file mode 100644 index 0000000..7a64ff3 --- /dev/null +++ b/Sources/ModelsSTU3/ExpansionProfile.swift @@ -0,0 +1,878 @@ +// +// ExpansionProfile.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ExpansionProfile) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines behaviour and contraints on the ValueSet Expansion operation. + + Resource to define constraints on the Expansion of a FHIR ValueSet. + */ +open class ExpansionProfile: DomainResource { + + override open class var resourceType: ResourceType { return .expansionProfile } + + /// Logical URI to reference this expansion profile (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the expansion profile + public var identifier: Identifier? + + /// Business version of the expansion profile + public var version: FHIRPrimitive? + + /// Name for this expansion profile (computer friendly) + public var name: FHIRPrimitive? + + /// The status of this expansion profile. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the expansion profile + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for expansion profile (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Fix use of a code system to a particular version + public var fixedVersion: [ExpansionProfileFixedVersion]? + + /// Systems/Versions to be exclude + public var excludedSystem: ExpansionProfileExcludedSystem? + + /// Whether the expansion should include concept designations + public var includeDesignations: FHIRPrimitive? + + /// When the expansion profile imposes designation contraints + public var designation: ExpansionProfileDesignation? + + /// Include or exclude the value set definition in the expansion + public var includeDefinition: FHIRPrimitive? + + /// Include or exclude inactive concepts in the expansion + public var activeOnly: FHIRPrimitive? + + /// Nested codes in the expansion or not + public var excludeNested: FHIRPrimitive? + + /// Include or exclude codes which cannot be rendered in user interfaces in the value set expansion + public var excludeNotForUI: FHIRPrimitive? + + /// Include or exclude codes which are post coordinated expressions in the value set expansion + public var excludePostCoordinated: FHIRPrimitive? + + /// Specify the language for the display element of codes in the value set expansion + public var displayLanguage: FHIRPrimitive? + + /// Controls behaviour of the value set expand operation when value sets are too large to be completely expanded + public var limitedExpansion: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + activeOnly: FHIRPrimitive? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + designation: ExpansionProfileDesignation? = nil, + displayLanguage: FHIRPrimitive? = nil, + excludeNested: FHIRPrimitive? = nil, + excludeNotForUI: FHIRPrimitive? = nil, + excludePostCoordinated: FHIRPrimitive? = nil, + excludedSystem: ExpansionProfileExcludedSystem? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + fixedVersion: [ExpansionProfileFixedVersion]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + includeDefinition: FHIRPrimitive? = nil, + includeDesignations: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + limitedExpansion: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + publisher: FHIRPrimitive? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + url: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(status: status) + self.activeOnly = activeOnly + self.contact = contact + self.contained = contained + self.date = date + self.description_fhir = description_fhir + self.designation = designation + self.displayLanguage = displayLanguage + self.excludeNested = excludeNested + self.excludeNotForUI = excludeNotForUI + self.excludePostCoordinated = excludePostCoordinated + self.excludedSystem = excludedSystem + self.experimental = experimental + self.`extension` = `extension` + self.fixedVersion = fixedVersion + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.includeDefinition = includeDefinition + self.includeDesignations = includeDesignations + self.jurisdiction = jurisdiction + self.language = language + self.limitedExpansion = limitedExpansion + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.publisher = publisher + self.text = text + self.url = url + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case activeOnly; case _activeOnly + case contact + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case designation + case displayLanguage; case _displayLanguage + case excludeNested; case _excludeNested + case excludeNotForUI; case _excludeNotForUI + case excludePostCoordinated; case _excludePostCoordinated + case excludedSystem + case experimental; case _experimental + case fixedVersion + case identifier + case includeDefinition; case _includeDefinition + case includeDesignations; case _includeDesignations + case jurisdiction + case limitedExpansion; case _limitedExpansion + case name; case _name + case publisher; case _publisher + case status; case _status + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.activeOnly = try FHIRPrimitive(from: _container, forKeyIfPresent: .activeOnly, auxiliaryKey: ._activeOnly) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.designation = try ExpansionProfileDesignation(from: _container, forKeyIfPresent: .designation) + self.displayLanguage = try FHIRPrimitive(from: _container, forKeyIfPresent: .displayLanguage, auxiliaryKey: ._displayLanguage) + self.excludeNested = try FHIRPrimitive(from: _container, forKeyIfPresent: .excludeNested, auxiliaryKey: ._excludeNested) + self.excludeNotForUI = try FHIRPrimitive(from: _container, forKeyIfPresent: .excludeNotForUI, auxiliaryKey: ._excludeNotForUI) + self.excludePostCoordinated = try FHIRPrimitive(from: _container, forKeyIfPresent: .excludePostCoordinated, auxiliaryKey: ._excludePostCoordinated) + self.excludedSystem = try ExpansionProfileExcludedSystem(from: _container, forKeyIfPresent: .excludedSystem) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.fixedVersion = try [ExpansionProfileFixedVersion](from: _container, forKeyIfPresent: .fixedVersion) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.includeDefinition = try FHIRPrimitive(from: _container, forKeyIfPresent: .includeDefinition, auxiliaryKey: ._includeDefinition) + self.includeDesignations = try FHIRPrimitive(from: _container, forKeyIfPresent: .includeDesignations, auxiliaryKey: ._includeDesignations) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.limitedExpansion = try FHIRPrimitive(from: _container, forKeyIfPresent: .limitedExpansion, auxiliaryKey: ._limitedExpansion) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try activeOnly?.encode(on: &_container, forKey: .activeOnly, auxiliaryKey: ._activeOnly) + try contact?.encode(on: &_container, forKey: .contact) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try designation?.encode(on: &_container, forKey: .designation) + try displayLanguage?.encode(on: &_container, forKey: .displayLanguage, auxiliaryKey: ._displayLanguage) + try excludeNested?.encode(on: &_container, forKey: .excludeNested, auxiliaryKey: ._excludeNested) + try excludeNotForUI?.encode(on: &_container, forKey: .excludeNotForUI, auxiliaryKey: ._excludeNotForUI) + try excludePostCoordinated?.encode(on: &_container, forKey: .excludePostCoordinated, auxiliaryKey: ._excludePostCoordinated) + try excludedSystem?.encode(on: &_container, forKey: .excludedSystem) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try fixedVersion?.encode(on: &_container, forKey: .fixedVersion) + try identifier?.encode(on: &_container, forKey: .identifier) + try includeDefinition?.encode(on: &_container, forKey: .includeDefinition, auxiliaryKey: ._includeDefinition) + try includeDesignations?.encode(on: &_container, forKey: .includeDesignations, auxiliaryKey: ._includeDesignations) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try limitedExpansion?.encode(on: &_container, forKey: .limitedExpansion, auxiliaryKey: ._limitedExpansion) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExpansionProfile else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return activeOnly == _other.activeOnly + && contact == _other.contact + && date == _other.date + && description_fhir == _other.description_fhir + && designation == _other.designation + && displayLanguage == _other.displayLanguage + && excludeNested == _other.excludeNested + && excludeNotForUI == _other.excludeNotForUI + && excludePostCoordinated == _other.excludePostCoordinated + && excludedSystem == _other.excludedSystem + && experimental == _other.experimental + && fixedVersion == _other.fixedVersion + && identifier == _other.identifier + && includeDefinition == _other.includeDefinition + && includeDesignations == _other.includeDesignations + && jurisdiction == _other.jurisdiction + && limitedExpansion == _other.limitedExpansion + && name == _other.name + && publisher == _other.publisher + && status == _other.status + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(activeOnly) + hasher.combine(contact) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(designation) + hasher.combine(displayLanguage) + hasher.combine(excludeNested) + hasher.combine(excludeNotForUI) + hasher.combine(excludePostCoordinated) + hasher.combine(excludedSystem) + hasher.combine(experimental) + hasher.combine(fixedVersion) + hasher.combine(identifier) + hasher.combine(includeDefinition) + hasher.combine(includeDesignations) + hasher.combine(jurisdiction) + hasher.combine(limitedExpansion) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(status) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + When the expansion profile imposes designation contraints. + + A set of criteria that provide the constraints imposed on the value set expansion by including or excluding + designations. + */ +open class ExpansionProfileDesignation: BackboneElement { + + /// Designations to be included + public var include: ExpansionProfileDesignationInclude? + + /// Designations to be excluded + public var exclude: ExpansionProfileDesignationExclude? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + exclude: ExpansionProfileDesignationExclude? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + include: ExpansionProfileDesignationInclude? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.exclude = exclude + self.`extension` = `extension` + self.id = id + self.include = include + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case exclude + case include + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.exclude = try ExpansionProfileDesignationExclude(from: _container, forKeyIfPresent: .exclude) + self.include = try ExpansionProfileDesignationInclude(from: _container, forKeyIfPresent: .include) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try exclude?.encode(on: &_container, forKey: .exclude) + try include?.encode(on: &_container, forKey: .include) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExpansionProfileDesignation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return exclude == _other.exclude + && include == _other.include + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(exclude) + hasher.combine(include) + } +} + +/** + Designations to be excluded. + */ +open class ExpansionProfileDesignationExclude: BackboneElement { + + /// The designation to be excluded + public var designation: [ExpansionProfileDesignationExcludeDesignation]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + designation: [ExpansionProfileDesignationExcludeDesignation]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.designation = designation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case designation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.designation = try [ExpansionProfileDesignationExcludeDesignation](from: _container, forKeyIfPresent: .designation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try designation?.encode(on: &_container, forKey: .designation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExpansionProfileDesignationExclude else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return designation == _other.designation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(designation) + } +} + +/** + The designation to be excluded. + + A data group for each designation to be excluded. + */ +open class ExpansionProfileDesignationExcludeDesignation: BackboneElement { + + /// Human language of the designation to be excluded + public var language: FHIRPrimitive? + + /// What kind of Designation to exclude + public var use: Coding? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + use: Coding? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.language = language + self.modifierExtension = modifierExtension + self.use = use + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case language; case _language + case use + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + self.use = try Coding(from: _container, forKeyIfPresent: .use) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try use?.encode(on: &_container, forKey: .use) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExpansionProfileDesignationExcludeDesignation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return language == _other.language + && use == _other.use + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(language) + hasher.combine(use) + } +} + +/** + Designations to be included. + */ +open class ExpansionProfileDesignationInclude: BackboneElement { + + /// The designation to be included + public var designation: [ExpansionProfileDesignationIncludeDesignation]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + designation: [ExpansionProfileDesignationIncludeDesignation]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.designation = designation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case designation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.designation = try [ExpansionProfileDesignationIncludeDesignation](from: _container, forKeyIfPresent: .designation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try designation?.encode(on: &_container, forKey: .designation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExpansionProfileDesignationInclude else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return designation == _other.designation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(designation) + } +} + +/** + The designation to be included. + + A data group for each designation to be included. + */ +open class ExpansionProfileDesignationIncludeDesignation: BackboneElement { + + /// Human language of the designation to be included + public var language: FHIRPrimitive? + + /// What kind of Designation to include + public var use: Coding? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + use: Coding? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.language = language + self.modifierExtension = modifierExtension + self.use = use + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case language; case _language + case use + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + self.use = try Coding(from: _container, forKeyIfPresent: .use) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try use?.encode(on: &_container, forKey: .use) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExpansionProfileDesignationIncludeDesignation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return language == _other.language + && use == _other.use + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(language) + hasher.combine(use) + } +} + +/** + Systems/Versions to be exclude. + + Code system, or a particular version of a code system to be excluded from value set expansions. + */ +open class ExpansionProfileExcludedSystem: BackboneElement { + + /// The specific code system to be excluded + public var system: FHIRPrimitive + + /// Specific version of the code system referred to + public var version: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(system: FHIRPrimitive) { + self.system = system + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + system: FHIRPrimitive, + version: FHIRPrimitive? = nil) + { + self.init(system: system) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case system; case _system + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.system = try FHIRPrimitive(from: _container, forKey: .system, auxiliaryKey: ._system) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try system.encode(on: &_container, forKey: .system, auxiliaryKey: ._system) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExpansionProfileExcludedSystem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return system == _other.system + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(system) + hasher.combine(version) + } +} + +/** + Fix use of a code system to a particular version. + + Fix use of a particular code system to a particular version. + */ +open class ExpansionProfileFixedVersion: BackboneElement { + + /// System to have its version fixed + public var system: FHIRPrimitive + + /// Specific version of the code system referred to + public var version: FHIRPrimitive + + /// How to manage the intersection between a fixed version in a value set, and this fixed version of the system in + /// the expansion profile. + public var mode: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(mode: FHIRPrimitive, system: FHIRPrimitive, version: FHIRPrimitive) { + self.mode = mode + self.system = system + self.version = version + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + mode: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + system: FHIRPrimitive, + version: FHIRPrimitive) + { + self.init(mode: mode, system: system, version: version) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case mode; case _mode + case system; case _system + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.mode = try FHIRPrimitive(from: _container, forKey: .mode, auxiliaryKey: ._mode) + self.system = try FHIRPrimitive(from: _container, forKey: .system, auxiliaryKey: ._system) + self.version = try FHIRPrimitive(from: _container, forKey: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try mode.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try system.encode(on: &_container, forKey: .system, auxiliaryKey: ._system) + try version.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExpansionProfileFixedVersion else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return mode == _other.mode + && system == _other.system + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(mode) + hasher.combine(system) + hasher.combine(version) + } +} diff --git a/Sources/ModelsSTU3/ExplanationOfBenefit.swift b/Sources/ModelsSTU3/ExplanationOfBenefit.swift new file mode 100644 index 0000000..45979ad --- /dev/null +++ b/Sources/ModelsSTU3/ExplanationOfBenefit.swift @@ -0,0 +1,3114 @@ +// +// ExplanationOfBenefit.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Explanation of Benefit resource. + + This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account + balance information, for informing the subscriber of the benefits provided. + */ +open class ExplanationOfBenefit: DomainResource { + + override open class var resourceType: ResourceType { return .explanationOfBenefit } + + /// Business Identifier + public var identifier: [Identifier]? + + /// The status of the resource instance. + public var status: FHIRPrimitive? + + /// Type or discipline + public var type: CodeableConcept? + + /// Finer grained claim type information + public var subType: [CodeableConcept]? + + /// The subject of the Products and Services + public var patient: Reference? + + /// Period for charge submission + public var billablePeriod: Period? + + /// Creation date + public var created: FHIRPrimitive? + + /// Author + public var enterer: Reference? + + /// Insurer responsible for the EOB + public var insurer: Reference? + + /// Responsible provider for the claim + public var provider: Reference? + + /// Responsible organization for the claim + public var organization: Reference? + + /// Treatment Referral + public var referral: Reference? + + /// Servicing Facility + public var facility: Reference? + + /// Claim reference + public var claim: Reference? + + /// Claim response reference + public var claimResponse: Reference? + + /// complete | error | partial + public var outcome: CodeableConcept? + + /// Disposition Message + public var disposition: FHIRPrimitive? + + /// Related Claims which may be revelant to processing this claim + public var related: [ExplanationOfBenefitRelated]? + + /// Prescription authorizing services or products + public var prescription: Reference? + + /// Original prescription if superceded by fulfiller + public var originalPrescription: Reference? + + /// Party to be paid any benefits payable + public var payee: ExplanationOfBenefitPayee? + + /// Exceptions, special considerations, the condition, situation, prior or concurrent issues + public var information: [ExplanationOfBenefitInformation]? + + /// Care Team members + public var careTeam: [ExplanationOfBenefitCareTeam]? + + /// List of Diagnosis + public var diagnosis: [ExplanationOfBenefitDiagnosis]? + + /// Procedures performed + public var procedure: [ExplanationOfBenefitProcedure]? + + /// Precedence (primary, secondary, etc.) + public var precedence: FHIRPrimitive? + + /// Insurance or medical plan + public var insurance: ExplanationOfBenefitInsurance? + + /// Details of an accident + public var accident: ExplanationOfBenefitAccident? + + /// Period unable to work + public var employmentImpacted: Period? + + /// Period in hospital + public var hospitalization: Period? + + /// Goods and Services + public var item: [ExplanationOfBenefitItem]? + + /// Insurer added line items + public var addItem: [ExplanationOfBenefitAddItem]? + + /// Total Cost of service from the Claim + public var totalCost: Money? + + /// Unallocated deductable + public var unallocDeductable: Money? + + /// Total benefit payable for the Claim + public var totalBenefit: Money? + + /// Payment (if paid) + public var payment: ExplanationOfBenefitPayment? + + /// Printed Form Identifier + public var form: CodeableConcept? + + /// Processing notes + public var processNote: [ExplanationOfBenefitProcessNote]? + + /// Balance by Benefit Category + public var benefitBalance: [ExplanationOfBenefitBenefitBalance]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + accident: ExplanationOfBenefitAccident? = nil, + addItem: [ExplanationOfBenefitAddItem]? = nil, + benefitBalance: [ExplanationOfBenefitBenefitBalance]? = nil, + billablePeriod: Period? = nil, + careTeam: [ExplanationOfBenefitCareTeam]? = nil, + claim: Reference? = nil, + claimResponse: Reference? = nil, + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + diagnosis: [ExplanationOfBenefitDiagnosis]? = nil, + disposition: FHIRPrimitive? = nil, + employmentImpacted: Period? = nil, + enterer: Reference? = nil, + `extension`: [Extension]? = nil, + facility: Reference? = nil, + form: CodeableConcept? = nil, + hospitalization: Period? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + information: [ExplanationOfBenefitInformation]? = nil, + insurance: ExplanationOfBenefitInsurance? = nil, + insurer: Reference? = nil, + item: [ExplanationOfBenefitItem]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + organization: Reference? = nil, + originalPrescription: Reference? = nil, + outcome: CodeableConcept? = nil, + patient: Reference? = nil, + payee: ExplanationOfBenefitPayee? = nil, + payment: ExplanationOfBenefitPayment? = nil, + precedence: FHIRPrimitive? = nil, + prescription: Reference? = nil, + procedure: [ExplanationOfBenefitProcedure]? = nil, + processNote: [ExplanationOfBenefitProcessNote]? = nil, + provider: Reference? = nil, + referral: Reference? = nil, + related: [ExplanationOfBenefitRelated]? = nil, + status: FHIRPrimitive? = nil, + subType: [CodeableConcept]? = nil, + text: Narrative? = nil, + totalBenefit: Money? = nil, + totalCost: Money? = nil, + type: CodeableConcept? = nil, + unallocDeductable: Money? = nil) + { + self.init() + self.accident = accident + self.addItem = addItem + self.benefitBalance = benefitBalance + self.billablePeriod = billablePeriod + self.careTeam = careTeam + self.claim = claim + self.claimResponse = claimResponse + self.contained = contained + self.created = created + self.diagnosis = diagnosis + self.disposition = disposition + self.employmentImpacted = employmentImpacted + self.enterer = enterer + self.`extension` = `extension` + self.facility = facility + self.form = form + self.hospitalization = hospitalization + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.information = information + self.insurance = insurance + self.insurer = insurer + self.item = item + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.organization = organization + self.originalPrescription = originalPrescription + self.outcome = outcome + self.patient = patient + self.payee = payee + self.payment = payment + self.precedence = precedence + self.prescription = prescription + self.procedure = procedure + self.processNote = processNote + self.provider = provider + self.referral = referral + self.related = related + self.status = status + self.subType = subType + self.text = text + self.totalBenefit = totalBenefit + self.totalCost = totalCost + self.type = type + self.unallocDeductable = unallocDeductable + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case accident + case addItem + case benefitBalance + case billablePeriod + case careTeam + case claim + case claimResponse + case created; case _created + case diagnosis + case disposition; case _disposition + case employmentImpacted + case enterer + case facility + case form + case hospitalization + case identifier + case information + case insurance + case insurer + case item + case organization + case originalPrescription + case outcome + case patient + case payee + case payment + case precedence; case _precedence + case prescription + case procedure + case processNote + case provider + case referral + case related + case status; case _status + case subType + case totalBenefit + case totalCost + case type + case unallocDeductable + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.accident = try ExplanationOfBenefitAccident(from: _container, forKeyIfPresent: .accident) + self.addItem = try [ExplanationOfBenefitAddItem](from: _container, forKeyIfPresent: .addItem) + self.benefitBalance = try [ExplanationOfBenefitBenefitBalance](from: _container, forKeyIfPresent: .benefitBalance) + self.billablePeriod = try Period(from: _container, forKeyIfPresent: .billablePeriod) + self.careTeam = try [ExplanationOfBenefitCareTeam](from: _container, forKeyIfPresent: .careTeam) + self.claim = try Reference(from: _container, forKeyIfPresent: .claim) + self.claimResponse = try Reference(from: _container, forKeyIfPresent: .claimResponse) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.diagnosis = try [ExplanationOfBenefitDiagnosis](from: _container, forKeyIfPresent: .diagnosis) + self.disposition = try FHIRPrimitive(from: _container, forKeyIfPresent: .disposition, auxiliaryKey: ._disposition) + self.employmentImpacted = try Period(from: _container, forKeyIfPresent: .employmentImpacted) + self.enterer = try Reference(from: _container, forKeyIfPresent: .enterer) + self.facility = try Reference(from: _container, forKeyIfPresent: .facility) + self.form = try CodeableConcept(from: _container, forKeyIfPresent: .form) + self.hospitalization = try Period(from: _container, forKeyIfPresent: .hospitalization) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.information = try [ExplanationOfBenefitInformation](from: _container, forKeyIfPresent: .information) + self.insurance = try ExplanationOfBenefitInsurance(from: _container, forKeyIfPresent: .insurance) + self.insurer = try Reference(from: _container, forKeyIfPresent: .insurer) + self.item = try [ExplanationOfBenefitItem](from: _container, forKeyIfPresent: .item) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.originalPrescription = try Reference(from: _container, forKeyIfPresent: .originalPrescription) + self.outcome = try CodeableConcept(from: _container, forKeyIfPresent: .outcome) + self.patient = try Reference(from: _container, forKeyIfPresent: .patient) + self.payee = try ExplanationOfBenefitPayee(from: _container, forKeyIfPresent: .payee) + self.payment = try ExplanationOfBenefitPayment(from: _container, forKeyIfPresent: .payment) + self.precedence = try FHIRPrimitive(from: _container, forKeyIfPresent: .precedence, auxiliaryKey: ._precedence) + self.prescription = try Reference(from: _container, forKeyIfPresent: .prescription) + self.procedure = try [ExplanationOfBenefitProcedure](from: _container, forKeyIfPresent: .procedure) + self.processNote = try [ExplanationOfBenefitProcessNote](from: _container, forKeyIfPresent: .processNote) + self.provider = try Reference(from: _container, forKeyIfPresent: .provider) + self.referral = try Reference(from: _container, forKeyIfPresent: .referral) + self.related = try [ExplanationOfBenefitRelated](from: _container, forKeyIfPresent: .related) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subType = try [CodeableConcept](from: _container, forKeyIfPresent: .subType) + self.totalBenefit = try Money(from: _container, forKeyIfPresent: .totalBenefit) + self.totalCost = try Money(from: _container, forKeyIfPresent: .totalCost) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + self.unallocDeductable = try Money(from: _container, forKeyIfPresent: .unallocDeductable) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try accident?.encode(on: &_container, forKey: .accident) + try addItem?.encode(on: &_container, forKey: .addItem) + try benefitBalance?.encode(on: &_container, forKey: .benefitBalance) + try billablePeriod?.encode(on: &_container, forKey: .billablePeriod) + try careTeam?.encode(on: &_container, forKey: .careTeam) + try claim?.encode(on: &_container, forKey: .claim) + try claimResponse?.encode(on: &_container, forKey: .claimResponse) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try diagnosis?.encode(on: &_container, forKey: .diagnosis) + try disposition?.encode(on: &_container, forKey: .disposition, auxiliaryKey: ._disposition) + try employmentImpacted?.encode(on: &_container, forKey: .employmentImpacted) + try enterer?.encode(on: &_container, forKey: .enterer) + try facility?.encode(on: &_container, forKey: .facility) + try form?.encode(on: &_container, forKey: .form) + try hospitalization?.encode(on: &_container, forKey: .hospitalization) + try identifier?.encode(on: &_container, forKey: .identifier) + try information?.encode(on: &_container, forKey: .information) + try insurance?.encode(on: &_container, forKey: .insurance) + try insurer?.encode(on: &_container, forKey: .insurer) + try item?.encode(on: &_container, forKey: .item) + try organization?.encode(on: &_container, forKey: .organization) + try originalPrescription?.encode(on: &_container, forKey: .originalPrescription) + try outcome?.encode(on: &_container, forKey: .outcome) + try patient?.encode(on: &_container, forKey: .patient) + try payee?.encode(on: &_container, forKey: .payee) + try payment?.encode(on: &_container, forKey: .payment) + try precedence?.encode(on: &_container, forKey: .precedence, auxiliaryKey: ._precedence) + try prescription?.encode(on: &_container, forKey: .prescription) + try procedure?.encode(on: &_container, forKey: .procedure) + try processNote?.encode(on: &_container, forKey: .processNote) + try provider?.encode(on: &_container, forKey: .provider) + try referral?.encode(on: &_container, forKey: .referral) + try related?.encode(on: &_container, forKey: .related) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subType?.encode(on: &_container, forKey: .subType) + try totalBenefit?.encode(on: &_container, forKey: .totalBenefit) + try totalCost?.encode(on: &_container, forKey: .totalCost) + try type?.encode(on: &_container, forKey: .type) + try unallocDeductable?.encode(on: &_container, forKey: .unallocDeductable) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefit else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return accident == _other.accident + && addItem == _other.addItem + && benefitBalance == _other.benefitBalance + && billablePeriod == _other.billablePeriod + && careTeam == _other.careTeam + && claim == _other.claim + && claimResponse == _other.claimResponse + && created == _other.created + && diagnosis == _other.diagnosis + && disposition == _other.disposition + && employmentImpacted == _other.employmentImpacted + && enterer == _other.enterer + && facility == _other.facility + && form == _other.form + && hospitalization == _other.hospitalization + && identifier == _other.identifier + && information == _other.information + && insurance == _other.insurance + && insurer == _other.insurer + && item == _other.item + && organization == _other.organization + && originalPrescription == _other.originalPrescription + && outcome == _other.outcome + && patient == _other.patient + && payee == _other.payee + && payment == _other.payment + && precedence == _other.precedence + && prescription == _other.prescription + && procedure == _other.procedure + && processNote == _other.processNote + && provider == _other.provider + && referral == _other.referral + && related == _other.related + && status == _other.status + && subType == _other.subType + && totalBenefit == _other.totalBenefit + && totalCost == _other.totalCost + && type == _other.type + && unallocDeductable == _other.unallocDeductable + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(accident) + hasher.combine(addItem) + hasher.combine(benefitBalance) + hasher.combine(billablePeriod) + hasher.combine(careTeam) + hasher.combine(claim) + hasher.combine(claimResponse) + hasher.combine(created) + hasher.combine(diagnosis) + hasher.combine(disposition) + hasher.combine(employmentImpacted) + hasher.combine(enterer) + hasher.combine(facility) + hasher.combine(form) + hasher.combine(hospitalization) + hasher.combine(identifier) + hasher.combine(information) + hasher.combine(insurance) + hasher.combine(insurer) + hasher.combine(item) + hasher.combine(organization) + hasher.combine(originalPrescription) + hasher.combine(outcome) + hasher.combine(patient) + hasher.combine(payee) + hasher.combine(payment) + hasher.combine(precedence) + hasher.combine(prescription) + hasher.combine(procedure) + hasher.combine(processNote) + hasher.combine(provider) + hasher.combine(referral) + hasher.combine(related) + hasher.combine(status) + hasher.combine(subType) + hasher.combine(totalBenefit) + hasher.combine(totalCost) + hasher.combine(type) + hasher.combine(unallocDeductable) + } +} + +/** + Details of an accident. + + An accident which resulted in the need for healthcare services. + */ +open class ExplanationOfBenefitAccident: BackboneElement { + + /// All possible types for "location[x]" + public enum LocationX: Hashable { + case address(Address) + case reference(Reference) + } + + /// When the accident occurred + public var date: FHIRPrimitive? + + /// The nature of the accident + public var type: CodeableConcept? + + /// Accident Place + /// One of `location[x]` + public var location: LocationX? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + date: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + location: LocationX? = nil, + modifierExtension: [Extension]? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.date = date + self.`extension` = `extension` + self.id = id + self.location = location + self.modifierExtension = modifierExtension + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case date; case _date + case locationAddress + case locationReference + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + var _t_location: LocationX? = nil + if let locationAddress = try Address(from: _container, forKeyIfPresent: .locationAddress) { + if _t_location != nil { + throw DecodingError.dataCorruptedError(forKey: .locationAddress, in: _container, debugDescription: "More than one value provided for \"location\"") + } + _t_location = .address(locationAddress) + } + if let locationReference = try Reference(from: _container, forKeyIfPresent: .locationReference) { + if _t_location != nil { + throw DecodingError.dataCorruptedError(forKey: .locationReference, in: _container, debugDescription: "More than one value provided for \"location\"") + } + _t_location = .reference(locationReference) + } + self.location = _t_location + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + if let _enum = location { + switch _enum { + case .address(let _value): + try _value.encode(on: &_container, forKey: .locationAddress) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .locationReference) + } + } + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitAccident else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return date == _other.date + && location == _other.location + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(date) + hasher.combine(location) + hasher.combine(type) + } +} + +/** + Insurer added line items. + + The first tier service adjudications for payor added services. + */ +open class ExplanationOfBenefitAddItem: BackboneElement { + + /// Service instances + public var sequenceLinkId: [FHIRPrimitive]? + + /// Revenue or cost center code + public var revenue: CodeableConcept? + + /// Type of service or product + public var category: CodeableConcept? + + /// Billing Code + public var service: CodeableConcept? + + /// Service/Product billing modifiers + public var modifier: [CodeableConcept]? + + /// Professional fee or Product charge + public var fee: Money? + + /// List of note numbers which apply + public var noteNumber: [FHIRPrimitive]? + + /// Added items adjudication + public var adjudication: [ExplanationOfBenefitItemAdjudication]? + + /// Added items details + public var detail: [ExplanationOfBenefitAddItemDetail]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + adjudication: [ExplanationOfBenefitItemAdjudication]? = nil, + category: CodeableConcept? = nil, + detail: [ExplanationOfBenefitAddItemDetail]? = nil, + `extension`: [Extension]? = nil, + fee: Money? = nil, + id: FHIRPrimitive? = nil, + modifier: [CodeableConcept]? = nil, + modifierExtension: [Extension]? = nil, + noteNumber: [FHIRPrimitive]? = nil, + revenue: CodeableConcept? = nil, + sequenceLinkId: [FHIRPrimitive]? = nil, + service: CodeableConcept? = nil) + { + self.init() + self.adjudication = adjudication + self.category = category + self.detail = detail + self.`extension` = `extension` + self.fee = fee + self.id = id + self.modifier = modifier + self.modifierExtension = modifierExtension + self.noteNumber = noteNumber + self.revenue = revenue + self.sequenceLinkId = sequenceLinkId + self.service = service + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjudication + case category + case detail + case fee + case modifier + case noteNumber; case _noteNumber + case revenue + case sequenceLinkId; case _sequenceLinkId + case service + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjudication = try [ExplanationOfBenefitItemAdjudication](from: _container, forKeyIfPresent: .adjudication) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.detail = try [ExplanationOfBenefitAddItemDetail](from: _container, forKeyIfPresent: .detail) + self.fee = try Money(from: _container, forKeyIfPresent: .fee) + self.modifier = try [CodeableConcept](from: _container, forKeyIfPresent: .modifier) + self.noteNumber = try [FHIRPrimitive](from: _container, forKeyIfPresent: .noteNumber, auxiliaryKey: ._noteNumber) + self.revenue = try CodeableConcept(from: _container, forKeyIfPresent: .revenue) + self.sequenceLinkId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + self.service = try CodeableConcept(from: _container, forKeyIfPresent: .service) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjudication?.encode(on: &_container, forKey: .adjudication) + try category?.encode(on: &_container, forKey: .category) + try detail?.encode(on: &_container, forKey: .detail) + try fee?.encode(on: &_container, forKey: .fee) + try modifier?.encode(on: &_container, forKey: .modifier) + try noteNumber?.encode(on: &_container, forKey: .noteNumber, auxiliaryKey: ._noteNumber) + try revenue?.encode(on: &_container, forKey: .revenue) + try sequenceLinkId?.encode(on: &_container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + try service?.encode(on: &_container, forKey: .service) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitAddItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjudication == _other.adjudication + && category == _other.category + && detail == _other.detail + && fee == _other.fee + && modifier == _other.modifier + && noteNumber == _other.noteNumber + && revenue == _other.revenue + && sequenceLinkId == _other.sequenceLinkId + && service == _other.service + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjudication) + hasher.combine(category) + hasher.combine(detail) + hasher.combine(fee) + hasher.combine(modifier) + hasher.combine(noteNumber) + hasher.combine(revenue) + hasher.combine(sequenceLinkId) + hasher.combine(service) + } +} + +/** + Added items details. + + The second tier service adjudications for payor added services. + */ +open class ExplanationOfBenefitAddItemDetail: BackboneElement { + + /// Revenue or cost center code + public var revenue: CodeableConcept? + + /// Type of service or product + public var category: CodeableConcept? + + /// Billing Code + public var service: CodeableConcept? + + /// Service/Product billing modifiers + public var modifier: [CodeableConcept]? + + /// Professional fee or Product charge + public var fee: Money? + + /// List of note numbers which apply + public var noteNumber: [FHIRPrimitive]? + + /// Added items detail adjudication + public var adjudication: [ExplanationOfBenefitItemAdjudication]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + adjudication: [ExplanationOfBenefitItemAdjudication]? = nil, + category: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + fee: Money? = nil, + id: FHIRPrimitive? = nil, + modifier: [CodeableConcept]? = nil, + modifierExtension: [Extension]? = nil, + noteNumber: [FHIRPrimitive]? = nil, + revenue: CodeableConcept? = nil, + service: CodeableConcept? = nil) + { + self.init() + self.adjudication = adjudication + self.category = category + self.`extension` = `extension` + self.fee = fee + self.id = id + self.modifier = modifier + self.modifierExtension = modifierExtension + self.noteNumber = noteNumber + self.revenue = revenue + self.service = service + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjudication + case category + case fee + case modifier + case noteNumber; case _noteNumber + case revenue + case service + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjudication = try [ExplanationOfBenefitItemAdjudication](from: _container, forKeyIfPresent: .adjudication) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.fee = try Money(from: _container, forKeyIfPresent: .fee) + self.modifier = try [CodeableConcept](from: _container, forKeyIfPresent: .modifier) + self.noteNumber = try [FHIRPrimitive](from: _container, forKeyIfPresent: .noteNumber, auxiliaryKey: ._noteNumber) + self.revenue = try CodeableConcept(from: _container, forKeyIfPresent: .revenue) + self.service = try CodeableConcept(from: _container, forKeyIfPresent: .service) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjudication?.encode(on: &_container, forKey: .adjudication) + try category?.encode(on: &_container, forKey: .category) + try fee?.encode(on: &_container, forKey: .fee) + try modifier?.encode(on: &_container, forKey: .modifier) + try noteNumber?.encode(on: &_container, forKey: .noteNumber, auxiliaryKey: ._noteNumber) + try revenue?.encode(on: &_container, forKey: .revenue) + try service?.encode(on: &_container, forKey: .service) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitAddItemDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjudication == _other.adjudication + && category == _other.category + && fee == _other.fee + && modifier == _other.modifier + && noteNumber == _other.noteNumber + && revenue == _other.revenue + && service == _other.service + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjudication) + hasher.combine(category) + hasher.combine(fee) + hasher.combine(modifier) + hasher.combine(noteNumber) + hasher.combine(revenue) + hasher.combine(service) + } +} + +/** + Balance by Benefit Category. + */ +open class ExplanationOfBenefitBenefitBalance: BackboneElement { + + /// Type of services covered + public var category: CodeableConcept + + /// Detailed services covered within the type + public var subCategory: CodeableConcept? + + /// Excluded from the plan + public var excluded: FHIRPrimitive? + + /// Short name for the benefit + public var name: FHIRPrimitive? + + /// Description of the benefit or services covered + public var description_fhir: FHIRPrimitive? + + /// In or out of network + public var network: CodeableConcept? + + /// Individual or family + public var unit: CodeableConcept? + + /// Annual or lifetime + public var term: CodeableConcept? + + /// Benefit Summary + public var financial: [ExplanationOfBenefitBenefitBalanceFinancial]? + + /// Designated initializer taking all required properties + public init(category: CodeableConcept) { + self.category = category + super.init() + } + + /// Convenience initializer + public convenience init( + category: CodeableConcept, + description_fhir: FHIRPrimitive? = nil, + excluded: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + financial: [ExplanationOfBenefitBenefitBalanceFinancial]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + network: CodeableConcept? = nil, + subCategory: CodeableConcept? = nil, + term: CodeableConcept? = nil, + unit: CodeableConcept? = nil) + { + self.init(category: category) + self.description_fhir = description_fhir + self.excluded = excluded + self.`extension` = `extension` + self.financial = financial + self.id = id + self.modifierExtension = modifierExtension + self.name = name + self.network = network + self.subCategory = subCategory + self.term = term + self.unit = unit + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category + case description_fhir = "description"; case _description_fhir = "_description" + case excluded; case _excluded + case financial + case name; case _name + case network + case subCategory + case term + case unit + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try CodeableConcept(from: _container, forKey: .category) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.excluded = try FHIRPrimitive(from: _container, forKeyIfPresent: .excluded, auxiliaryKey: ._excluded) + self.financial = try [ExplanationOfBenefitBenefitBalanceFinancial](from: _container, forKeyIfPresent: .financial) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.network = try CodeableConcept(from: _container, forKeyIfPresent: .network) + self.subCategory = try CodeableConcept(from: _container, forKeyIfPresent: .subCategory) + self.term = try CodeableConcept(from: _container, forKeyIfPresent: .term) + self.unit = try CodeableConcept(from: _container, forKeyIfPresent: .unit) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category.encode(on: &_container, forKey: .category) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try excluded?.encode(on: &_container, forKey: .excluded, auxiliaryKey: ._excluded) + try financial?.encode(on: &_container, forKey: .financial) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try network?.encode(on: &_container, forKey: .network) + try subCategory?.encode(on: &_container, forKey: .subCategory) + try term?.encode(on: &_container, forKey: .term) + try unit?.encode(on: &_container, forKey: .unit) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitBenefitBalance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && description_fhir == _other.description_fhir + && excluded == _other.excluded + && financial == _other.financial + && name == _other.name + && network == _other.network + && subCategory == _other.subCategory + && term == _other.term + && unit == _other.unit + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(description_fhir) + hasher.combine(excluded) + hasher.combine(financial) + hasher.combine(name) + hasher.combine(network) + hasher.combine(subCategory) + hasher.combine(term) + hasher.combine(unit) + } +} + +/** + Benefit Summary. + + Benefits Used to date. + */ +open class ExplanationOfBenefitBenefitBalanceFinancial: BackboneElement { + + /// All possible types for "allowed[x]" + public enum AllowedX: Hashable { + case money(Money) + case string(FHIRPrimitive) + case unsignedInt(FHIRPrimitive) + } + + /// All possible types for "used[x]" + public enum UsedX: Hashable { + case money(Money) + case unsignedInt(FHIRPrimitive) + } + + /// Deductable, visits, benefit amount + public var type: CodeableConcept + + /// Benefits allowed + /// One of `allowed[x]` + public var allowed: AllowedX? + + /// Benefits used + /// One of `used[x]` + public var used: UsedX? + + /// Designated initializer taking all required properties + public init(type: CodeableConcept) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + allowed: AllowedX? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: CodeableConcept, + used: UsedX? = nil) + { + self.init(type: type) + self.allowed = allowed + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.used = used + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case allowedMoney + case allowedString; case _allowedString + case allowedUnsignedInt; case _allowedUnsignedInt + case type + case usedMoney + case usedUnsignedInt; case _usedUnsignedInt + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_allowed: AllowedX? = nil + if let allowedUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .allowedUnsignedInt, auxiliaryKey: ._allowedUnsignedInt) { + if _t_allowed != nil { + throw DecodingError.dataCorruptedError(forKey: .allowedUnsignedInt, in: _container, debugDescription: "More than one value provided for \"allowed\"") + } + _t_allowed = .unsignedInt(allowedUnsignedInt) + } + if let allowedString = try FHIRPrimitive(from: _container, forKeyIfPresent: .allowedString, auxiliaryKey: ._allowedString) { + if _t_allowed != nil { + throw DecodingError.dataCorruptedError(forKey: .allowedString, in: _container, debugDescription: "More than one value provided for \"allowed\"") + } + _t_allowed = .string(allowedString) + } + if let allowedMoney = try Money(from: _container, forKeyIfPresent: .allowedMoney) { + if _t_allowed != nil { + throw DecodingError.dataCorruptedError(forKey: .allowedMoney, in: _container, debugDescription: "More than one value provided for \"allowed\"") + } + _t_allowed = .money(allowedMoney) + } + self.allowed = _t_allowed + self.type = try CodeableConcept(from: _container, forKey: .type) + var _t_used: UsedX? = nil + if let usedUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .usedUnsignedInt, auxiliaryKey: ._usedUnsignedInt) { + if _t_used != nil { + throw DecodingError.dataCorruptedError(forKey: .usedUnsignedInt, in: _container, debugDescription: "More than one value provided for \"used\"") + } + _t_used = .unsignedInt(usedUnsignedInt) + } + if let usedMoney = try Money(from: _container, forKeyIfPresent: .usedMoney) { + if _t_used != nil { + throw DecodingError.dataCorruptedError(forKey: .usedMoney, in: _container, debugDescription: "More than one value provided for \"used\"") + } + _t_used = .money(usedMoney) + } + self.used = _t_used + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = allowed { + switch _enum { + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .allowedUnsignedInt, auxiliaryKey: ._allowedUnsignedInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .allowedString, auxiliaryKey: ._allowedString) + case .money(let _value): + try _value.encode(on: &_container, forKey: .allowedMoney) + } + } + try type.encode(on: &_container, forKey: .type) + if let _enum = used { + switch _enum { + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .usedUnsignedInt, auxiliaryKey: ._usedUnsignedInt) + case .money(let _value): + try _value.encode(on: &_container, forKey: .usedMoney) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitBenefitBalanceFinancial else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return allowed == _other.allowed + && type == _other.type + && used == _other.used + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(allowed) + hasher.combine(type) + hasher.combine(used) + } +} + +/** + Care Team members. + + The members of the team who provided the overall service as well as their role and whether responsible and + qualifications. + */ +open class ExplanationOfBenefitCareTeam: BackboneElement { + + /// Number to covey order of careteam + public var sequence: FHIRPrimitive + + /// Member of the Care Team + public var provider: Reference + + /// Billing practitioner + public var responsible: FHIRPrimitive? + + /// Role on the team + public var role: CodeableConcept? + + /// Type, classification or Specialization + public var qualification: CodeableConcept? + + /// Designated initializer taking all required properties + public init(provider: Reference, sequence: FHIRPrimitive) { + self.provider = provider + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + provider: Reference, + qualification: CodeableConcept? = nil, + responsible: FHIRPrimitive? = nil, + role: CodeableConcept? = nil, + sequence: FHIRPrimitive) + { + self.init(provider: provider, sequence: sequence) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.qualification = qualification + self.responsible = responsible + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case provider + case qualification + case responsible; case _responsible + case role + case sequence; case _sequence + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.provider = try Reference(from: _container, forKey: .provider) + self.qualification = try CodeableConcept(from: _container, forKeyIfPresent: .qualification) + self.responsible = try FHIRPrimitive(from: _container, forKeyIfPresent: .responsible, auxiliaryKey: ._responsible) + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try provider.encode(on: &_container, forKey: .provider) + try qualification?.encode(on: &_container, forKey: .qualification) + try responsible?.encode(on: &_container, forKey: .responsible, auxiliaryKey: ._responsible) + try role?.encode(on: &_container, forKey: .role) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitCareTeam else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return provider == _other.provider + && qualification == _other.qualification + && responsible == _other.responsible + && role == _other.role + && sequence == _other.sequence + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(provider) + hasher.combine(qualification) + hasher.combine(responsible) + hasher.combine(role) + hasher.combine(sequence) + } +} + +/** + List of Diagnosis. + + Ordered list of patient diagnosis for which care is sought. + */ +open class ExplanationOfBenefitDiagnosis: BackboneElement { + + /// All possible types for "diagnosis[x]" + public enum DiagnosisX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Number to covey order of diagnosis + public var sequence: FHIRPrimitive + + /// Patient's diagnosis + /// One of `diagnosis[x]` + public var diagnosis: DiagnosisX + + /// Timing or nature of the diagnosis + public var type: [CodeableConcept]? + + /// Package billing code + public var packageCode: CodeableConcept? + + /// Designated initializer taking all required properties + public init(diagnosis: DiagnosisX, sequence: FHIRPrimitive) { + self.diagnosis = diagnosis + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + diagnosis: DiagnosisX, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + packageCode: CodeableConcept? = nil, + sequence: FHIRPrimitive, + type: [CodeableConcept]? = nil) + { + self.init(diagnosis: diagnosis, sequence: sequence) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.packageCode = packageCode + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case diagnosisCodeableConcept + case diagnosisReference + case packageCode + case sequence; case _sequence + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.diagnosisCodeableConcept) || _container.contains(CodingKeys.diagnosisReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.diagnosisCodeableConcept, CodingKeys.diagnosisReference], debugDescription: "Must have at least one value for \"diagnosis\" but have none")) + } + + // Decode all our properties + var _t_diagnosis: DiagnosisX? = nil + if let diagnosisCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .diagnosisCodeableConcept) { + if _t_diagnosis != nil { + throw DecodingError.dataCorruptedError(forKey: .diagnosisCodeableConcept, in: _container, debugDescription: "More than one value provided for \"diagnosis\"") + } + _t_diagnosis = .codeableConcept(diagnosisCodeableConcept) + } + if let diagnosisReference = try Reference(from: _container, forKeyIfPresent: .diagnosisReference) { + if _t_diagnosis != nil { + throw DecodingError.dataCorruptedError(forKey: .diagnosisReference, in: _container, debugDescription: "More than one value provided for \"diagnosis\"") + } + _t_diagnosis = .reference(diagnosisReference) + } + self.diagnosis = _t_diagnosis! + self.packageCode = try CodeableConcept(from: _container, forKeyIfPresent: .packageCode) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + self.type = try [CodeableConcept](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + + switch diagnosis { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .diagnosisCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .diagnosisReference) + } + + try packageCode?.encode(on: &_container, forKey: .packageCode) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitDiagnosis else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return diagnosis == _other.diagnosis + && packageCode == _other.packageCode + && sequence == _other.sequence + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(diagnosis) + hasher.combine(packageCode) + hasher.combine(sequence) + hasher.combine(type) + } +} + +/** + Exceptions, special considerations, the condition, situation, prior or concurrent issues. + + Additional information codes regarding exceptions, special considerations, the condition, situation, prior or + concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required. + */ +open class ExplanationOfBenefitInformation: BackboneElement { + + /// All possible types for "timing[x]" + public enum TimingX: Hashable { + case date(FHIRPrimitive) + case period(Period) + } + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case attachment(Attachment) + case quantity(Quantity) + case reference(Reference) + case string(FHIRPrimitive) + } + + /// Information instance identifier + public var sequence: FHIRPrimitive + + /// General class of information + public var category: CodeableConcept + + /// Type of information + public var code: CodeableConcept? + + /// When it occurred + /// One of `timing[x]` + public var timing: TimingX? + + /// Additional Data or supporting information + /// One of `value[x]` + public var value: ValueX? + + /// Reason associated with the information + public var reason: Coding? + + /// Designated initializer taking all required properties + public init(category: CodeableConcept, sequence: FHIRPrimitive) { + self.category = category + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + category: CodeableConcept, + code: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reason: Coding? = nil, + sequence: FHIRPrimitive, + timing: TimingX? = nil, + value: ValueX? = nil) + { + self.init(category: category, sequence: sequence) + self.code = code + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reason = reason + self.timing = timing + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category + case code + case reason + case sequence; case _sequence + case timingDate; case _timingDate + case timingPeriod + case valueAttachment + case valueQuantity + case valueReference + case valueString; case _valueString + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try CodeableConcept(from: _container, forKey: .category) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.reason = try Coding(from: _container, forKeyIfPresent: .reason) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + var _t_timing: TimingX? = nil + if let timingDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .timingDate, auxiliaryKey: ._timingDate) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingDate, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .date(timingDate) + } + if let timingPeriod = try Period(from: _container, forKeyIfPresent: .timingPeriod) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingPeriod, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .period(timingPeriod) + } + self.timing = _t_timing + var _t_value: ValueX? = nil + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueAttachment = try Attachment(from: _container, forKeyIfPresent: .valueAttachment) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAttachment, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .attachment(valueAttachment) + } + if let valueReference = try Reference(from: _container, forKeyIfPresent: .valueReference) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueReference, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .reference(valueReference) + } + self.value = _t_value + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category.encode(on: &_container, forKey: .category) + try code?.encode(on: &_container, forKey: .code) + try reason?.encode(on: &_container, forKey: .reason) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + if let _enum = timing { + switch _enum { + case .date(let _value): + try _value.encode(on: &_container, forKey: .timingDate, auxiliaryKey: ._timingDate) + case .period(let _value): + try _value.encode(on: &_container, forKey: .timingPeriod) + } + } + if let _enum = value { + switch _enum { + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .valueAttachment) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueReference) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitInformation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && code == _other.code + && reason == _other.reason + && sequence == _other.sequence + && timing == _other.timing + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(code) + hasher.combine(reason) + hasher.combine(sequence) + hasher.combine(timing) + hasher.combine(value) + } +} + +/** + Insurance or medical plan. + + Financial instrument by which payment information for health care. + */ +open class ExplanationOfBenefitInsurance: BackboneElement { + + /// Insurance information + public var coverage: Reference? + + /// Pre-Authorization/Determination Reference + public var preAuthRef: [FHIRPrimitive]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + coverage: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + preAuthRef: [FHIRPrimitive]? = nil) + { + self.init() + self.coverage = coverage + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.preAuthRef = preAuthRef + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case coverage + case preAuthRef; case _preAuthRef + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.coverage = try Reference(from: _container, forKeyIfPresent: .coverage) + self.preAuthRef = try [FHIRPrimitive](from: _container, forKeyIfPresent: .preAuthRef, auxiliaryKey: ._preAuthRef) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try coverage?.encode(on: &_container, forKey: .coverage) + try preAuthRef?.encode(on: &_container, forKey: .preAuthRef, auxiliaryKey: ._preAuthRef) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitInsurance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return coverage == _other.coverage + && preAuthRef == _other.preAuthRef + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(coverage) + hasher.combine(preAuthRef) + } +} + +/** + Goods and Services. + + First tier of goods and services. + */ +open class ExplanationOfBenefitItem: BackboneElement { + + /// All possible types for "location[x]" + public enum LocationX: Hashable { + case address(Address) + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// All possible types for "serviced[x]" + public enum ServicedX: Hashable { + case date(FHIRPrimitive) + case period(Period) + } + + /// Service instance + public var sequence: FHIRPrimitive + + /// Applicable careteam members + public var careTeamLinkId: [FHIRPrimitive]? + + /// Applicable diagnoses + public var diagnosisLinkId: [FHIRPrimitive]? + + /// Applicable procedures + public var procedureLinkId: [FHIRPrimitive]? + + /// Applicable exception and supporting information + public var informationLinkId: [FHIRPrimitive]? + + /// Revenue or cost center code + public var revenue: CodeableConcept? + + /// Type of service or product + public var category: CodeableConcept? + + /// Billing Code + public var service: CodeableConcept? + + /// Service/Product billing modifiers + public var modifier: [CodeableConcept]? + + /// Program specific reason for item inclusion + public var programCode: [CodeableConcept]? + + /// Date or dates of Service + /// One of `serviced[x]` + public var serviced: ServicedX? + + /// Place of service + /// One of `location[x]` + public var location: LocationX? + + /// Count of Products or Services + public var quantity: Quantity? + + /// Fee, charge or cost per point + public var unitPrice: Money? + + /// Price scaling factor + public var factor: FHIRPrimitive? + + /// Total item cost + public var net: Money? + + /// Unique Device Identifier + public var udi: [Reference]? + + /// Service Location + public var bodySite: CodeableConcept? + + /// Service Sub-location + public var subSite: [CodeableConcept]? + + /// Encounters related to this billed item + public var encounter: [Reference]? + + /// List of note numbers which apply + public var noteNumber: [FHIRPrimitive]? + + /// Adjudication details + public var adjudication: [ExplanationOfBenefitItemAdjudication]? + + /// Additional items + public var detail: [ExplanationOfBenefitItemDetail]? + + /// Designated initializer taking all required properties + public init(sequence: FHIRPrimitive) { + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + adjudication: [ExplanationOfBenefitItemAdjudication]? = nil, + bodySite: CodeableConcept? = nil, + careTeamLinkId: [FHIRPrimitive]? = nil, + category: CodeableConcept? = nil, + detail: [ExplanationOfBenefitItemDetail]? = nil, + diagnosisLinkId: [FHIRPrimitive]? = nil, + encounter: [Reference]? = nil, + `extension`: [Extension]? = nil, + factor: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + informationLinkId: [FHIRPrimitive]? = nil, + location: LocationX? = nil, + modifier: [CodeableConcept]? = nil, + modifierExtension: [Extension]? = nil, + net: Money? = nil, + noteNumber: [FHIRPrimitive]? = nil, + procedureLinkId: [FHIRPrimitive]? = nil, + programCode: [CodeableConcept]? = nil, + quantity: Quantity? = nil, + revenue: CodeableConcept? = nil, + sequence: FHIRPrimitive, + service: CodeableConcept? = nil, + serviced: ServicedX? = nil, + subSite: [CodeableConcept]? = nil, + udi: [Reference]? = nil, + unitPrice: Money? = nil) + { + self.init(sequence: sequence) + self.adjudication = adjudication + self.bodySite = bodySite + self.careTeamLinkId = careTeamLinkId + self.category = category + self.detail = detail + self.diagnosisLinkId = diagnosisLinkId + self.encounter = encounter + self.`extension` = `extension` + self.factor = factor + self.id = id + self.informationLinkId = informationLinkId + self.location = location + self.modifier = modifier + self.modifierExtension = modifierExtension + self.net = net + self.noteNumber = noteNumber + self.procedureLinkId = procedureLinkId + self.programCode = programCode + self.quantity = quantity + self.revenue = revenue + self.service = service + self.serviced = serviced + self.subSite = subSite + self.udi = udi + self.unitPrice = unitPrice + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjudication + case bodySite + case careTeamLinkId; case _careTeamLinkId + case category + case detail + case diagnosisLinkId; case _diagnosisLinkId + case encounter + case factor; case _factor + case informationLinkId; case _informationLinkId + case locationAddress + case locationCodeableConcept + case locationReference + case modifier + case net + case noteNumber; case _noteNumber + case procedureLinkId; case _procedureLinkId + case programCode + case quantity + case revenue + case sequence; case _sequence + case service + case servicedDate; case _servicedDate + case servicedPeriod + case subSite + case udi + case unitPrice + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjudication = try [ExplanationOfBenefitItemAdjudication](from: _container, forKeyIfPresent: .adjudication) + self.bodySite = try CodeableConcept(from: _container, forKeyIfPresent: .bodySite) + self.careTeamLinkId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .careTeamLinkId, auxiliaryKey: ._careTeamLinkId) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.detail = try [ExplanationOfBenefitItemDetail](from: _container, forKeyIfPresent: .detail) + self.diagnosisLinkId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .diagnosisLinkId, auxiliaryKey: ._diagnosisLinkId) + self.encounter = try [Reference](from: _container, forKeyIfPresent: .encounter) + self.factor = try FHIRPrimitive(from: _container, forKeyIfPresent: .factor, auxiliaryKey: ._factor) + self.informationLinkId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .informationLinkId, auxiliaryKey: ._informationLinkId) + var _t_location: LocationX? = nil + if let locationCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .locationCodeableConcept) { + if _t_location != nil { + throw DecodingError.dataCorruptedError(forKey: .locationCodeableConcept, in: _container, debugDescription: "More than one value provided for \"location\"") + } + _t_location = .codeableConcept(locationCodeableConcept) + } + if let locationAddress = try Address(from: _container, forKeyIfPresent: .locationAddress) { + if _t_location != nil { + throw DecodingError.dataCorruptedError(forKey: .locationAddress, in: _container, debugDescription: "More than one value provided for \"location\"") + } + _t_location = .address(locationAddress) + } + if let locationReference = try Reference(from: _container, forKeyIfPresent: .locationReference) { + if _t_location != nil { + throw DecodingError.dataCorruptedError(forKey: .locationReference, in: _container, debugDescription: "More than one value provided for \"location\"") + } + _t_location = .reference(locationReference) + } + self.location = _t_location + self.modifier = try [CodeableConcept](from: _container, forKeyIfPresent: .modifier) + self.net = try Money(from: _container, forKeyIfPresent: .net) + self.noteNumber = try [FHIRPrimitive](from: _container, forKeyIfPresent: .noteNumber, auxiliaryKey: ._noteNumber) + self.procedureLinkId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .procedureLinkId, auxiliaryKey: ._procedureLinkId) + self.programCode = try [CodeableConcept](from: _container, forKeyIfPresent: .programCode) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.revenue = try CodeableConcept(from: _container, forKeyIfPresent: .revenue) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + self.service = try CodeableConcept(from: _container, forKeyIfPresent: .service) + var _t_serviced: ServicedX? = nil + if let servicedDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .servicedDate, auxiliaryKey: ._servicedDate) { + if _t_serviced != nil { + throw DecodingError.dataCorruptedError(forKey: .servicedDate, in: _container, debugDescription: "More than one value provided for \"serviced\"") + } + _t_serviced = .date(servicedDate) + } + if let servicedPeriod = try Period(from: _container, forKeyIfPresent: .servicedPeriod) { + if _t_serviced != nil { + throw DecodingError.dataCorruptedError(forKey: .servicedPeriod, in: _container, debugDescription: "More than one value provided for \"serviced\"") + } + _t_serviced = .period(servicedPeriod) + } + self.serviced = _t_serviced + self.subSite = try [CodeableConcept](from: _container, forKeyIfPresent: .subSite) + self.udi = try [Reference](from: _container, forKeyIfPresent: .udi) + self.unitPrice = try Money(from: _container, forKeyIfPresent: .unitPrice) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjudication?.encode(on: &_container, forKey: .adjudication) + try bodySite?.encode(on: &_container, forKey: .bodySite) + try careTeamLinkId?.encode(on: &_container, forKey: .careTeamLinkId, auxiliaryKey: ._careTeamLinkId) + try category?.encode(on: &_container, forKey: .category) + try detail?.encode(on: &_container, forKey: .detail) + try diagnosisLinkId?.encode(on: &_container, forKey: .diagnosisLinkId, auxiliaryKey: ._diagnosisLinkId) + try encounter?.encode(on: &_container, forKey: .encounter) + try factor?.encode(on: &_container, forKey: .factor, auxiliaryKey: ._factor) + try informationLinkId?.encode(on: &_container, forKey: .informationLinkId, auxiliaryKey: ._informationLinkId) + if let _enum = location { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .locationCodeableConcept) + case .address(let _value): + try _value.encode(on: &_container, forKey: .locationAddress) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .locationReference) + } + } + try modifier?.encode(on: &_container, forKey: .modifier) + try net?.encode(on: &_container, forKey: .net) + try noteNumber?.encode(on: &_container, forKey: .noteNumber, auxiliaryKey: ._noteNumber) + try procedureLinkId?.encode(on: &_container, forKey: .procedureLinkId, auxiliaryKey: ._procedureLinkId) + try programCode?.encode(on: &_container, forKey: .programCode) + try quantity?.encode(on: &_container, forKey: .quantity) + try revenue?.encode(on: &_container, forKey: .revenue) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try service?.encode(on: &_container, forKey: .service) + if let _enum = serviced { + switch _enum { + case .date(let _value): + try _value.encode(on: &_container, forKey: .servicedDate, auxiliaryKey: ._servicedDate) + case .period(let _value): + try _value.encode(on: &_container, forKey: .servicedPeriod) + } + } + try subSite?.encode(on: &_container, forKey: .subSite) + try udi?.encode(on: &_container, forKey: .udi) + try unitPrice?.encode(on: &_container, forKey: .unitPrice) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjudication == _other.adjudication + && bodySite == _other.bodySite + && careTeamLinkId == _other.careTeamLinkId + && category == _other.category + && detail == _other.detail + && diagnosisLinkId == _other.diagnosisLinkId + && encounter == _other.encounter + && factor == _other.factor + && informationLinkId == _other.informationLinkId + && location == _other.location + && modifier == _other.modifier + && net == _other.net + && noteNumber == _other.noteNumber + && procedureLinkId == _other.procedureLinkId + && programCode == _other.programCode + && quantity == _other.quantity + && revenue == _other.revenue + && sequence == _other.sequence + && service == _other.service + && serviced == _other.serviced + && subSite == _other.subSite + && udi == _other.udi + && unitPrice == _other.unitPrice + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjudication) + hasher.combine(bodySite) + hasher.combine(careTeamLinkId) + hasher.combine(category) + hasher.combine(detail) + hasher.combine(diagnosisLinkId) + hasher.combine(encounter) + hasher.combine(factor) + hasher.combine(informationLinkId) + hasher.combine(location) + hasher.combine(modifier) + hasher.combine(net) + hasher.combine(noteNumber) + hasher.combine(procedureLinkId) + hasher.combine(programCode) + hasher.combine(quantity) + hasher.combine(revenue) + hasher.combine(sequence) + hasher.combine(service) + hasher.combine(serviced) + hasher.combine(subSite) + hasher.combine(udi) + hasher.combine(unitPrice) + } +} + +/** + Adjudication details. + + The adjudications results. + */ +open class ExplanationOfBenefitItemAdjudication: BackboneElement { + + /// Adjudication category such as co-pay, eligible, benefit, etc. + public var category: CodeableConcept + + /// Explanation of Adjudication outcome + public var reason: CodeableConcept? + + /// Monetary amount + public var amount: Money? + + /// Non-monitory value + public var value: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(category: CodeableConcept) { + self.category = category + super.init() + } + + /// Convenience initializer + public convenience init( + amount: Money? = nil, + category: CodeableConcept, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reason: CodeableConcept? = nil, + value: FHIRPrimitive? = nil) + { + self.init(category: category) + self.amount = amount + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reason = reason + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case amount + case category + case reason + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.amount = try Money(from: _container, forKeyIfPresent: .amount) + self.category = try CodeableConcept(from: _container, forKey: .category) + self.reason = try CodeableConcept(from: _container, forKeyIfPresent: .reason) + self.value = try FHIRPrimitive(from: _container, forKeyIfPresent: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try amount?.encode(on: &_container, forKey: .amount) + try category.encode(on: &_container, forKey: .category) + try reason?.encode(on: &_container, forKey: .reason) + try value?.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitItemAdjudication else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return amount == _other.amount + && category == _other.category + && reason == _other.reason + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(amount) + hasher.combine(category) + hasher.combine(reason) + hasher.combine(value) + } +} + +/** + Additional items. + + Second tier of goods and services. + */ +open class ExplanationOfBenefitItemDetail: BackboneElement { + + /// Service instance + public var sequence: FHIRPrimitive + + /// Group or type of product or service + public var type: CodeableConcept + + /// Revenue or cost center code + public var revenue: CodeableConcept? + + /// Type of service or product + public var category: CodeableConcept? + + /// Billing Code + public var service: CodeableConcept? + + /// Service/Product billing modifiers + public var modifier: [CodeableConcept]? + + /// Program specific reason for item inclusion + public var programCode: [CodeableConcept]? + + /// Count of Products or Services + public var quantity: Quantity? + + /// Fee, charge or cost per point + public var unitPrice: Money? + + /// Price scaling factor + public var factor: FHIRPrimitive? + + /// Total additional item cost + public var net: Money? + + /// Unique Device Identifier + public var udi: [Reference]? + + /// List of note numbers which apply + public var noteNumber: [FHIRPrimitive]? + + /// Detail level adjudication details + public var adjudication: [ExplanationOfBenefitItemAdjudication]? + + /// Additional items + public var subDetail: [ExplanationOfBenefitItemDetailSubDetail]? + + /// Designated initializer taking all required properties + public init(sequence: FHIRPrimitive, type: CodeableConcept) { + self.sequence = sequence + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + adjudication: [ExplanationOfBenefitItemAdjudication]? = nil, + category: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + factor: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + modifier: [CodeableConcept]? = nil, + modifierExtension: [Extension]? = nil, + net: Money? = nil, + noteNumber: [FHIRPrimitive]? = nil, + programCode: [CodeableConcept]? = nil, + quantity: Quantity? = nil, + revenue: CodeableConcept? = nil, + sequence: FHIRPrimitive, + service: CodeableConcept? = nil, + subDetail: [ExplanationOfBenefitItemDetailSubDetail]? = nil, + type: CodeableConcept, + udi: [Reference]? = nil, + unitPrice: Money? = nil) + { + self.init(sequence: sequence, type: type) + self.adjudication = adjudication + self.category = category + self.`extension` = `extension` + self.factor = factor + self.id = id + self.modifier = modifier + self.modifierExtension = modifierExtension + self.net = net + self.noteNumber = noteNumber + self.programCode = programCode + self.quantity = quantity + self.revenue = revenue + self.service = service + self.subDetail = subDetail + self.udi = udi + self.unitPrice = unitPrice + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjudication + case category + case factor; case _factor + case modifier + case net + case noteNumber; case _noteNumber + case programCode + case quantity + case revenue + case sequence; case _sequence + case service + case subDetail + case type + case udi + case unitPrice + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjudication = try [ExplanationOfBenefitItemAdjudication](from: _container, forKeyIfPresent: .adjudication) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.factor = try FHIRPrimitive(from: _container, forKeyIfPresent: .factor, auxiliaryKey: ._factor) + self.modifier = try [CodeableConcept](from: _container, forKeyIfPresent: .modifier) + self.net = try Money(from: _container, forKeyIfPresent: .net) + self.noteNumber = try [FHIRPrimitive](from: _container, forKeyIfPresent: .noteNumber, auxiliaryKey: ._noteNumber) + self.programCode = try [CodeableConcept](from: _container, forKeyIfPresent: .programCode) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.revenue = try CodeableConcept(from: _container, forKeyIfPresent: .revenue) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + self.service = try CodeableConcept(from: _container, forKeyIfPresent: .service) + self.subDetail = try [ExplanationOfBenefitItemDetailSubDetail](from: _container, forKeyIfPresent: .subDetail) + self.type = try CodeableConcept(from: _container, forKey: .type) + self.udi = try [Reference](from: _container, forKeyIfPresent: .udi) + self.unitPrice = try Money(from: _container, forKeyIfPresent: .unitPrice) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjudication?.encode(on: &_container, forKey: .adjudication) + try category?.encode(on: &_container, forKey: .category) + try factor?.encode(on: &_container, forKey: .factor, auxiliaryKey: ._factor) + try modifier?.encode(on: &_container, forKey: .modifier) + try net?.encode(on: &_container, forKey: .net) + try noteNumber?.encode(on: &_container, forKey: .noteNumber, auxiliaryKey: ._noteNumber) + try programCode?.encode(on: &_container, forKey: .programCode) + try quantity?.encode(on: &_container, forKey: .quantity) + try revenue?.encode(on: &_container, forKey: .revenue) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try service?.encode(on: &_container, forKey: .service) + try subDetail?.encode(on: &_container, forKey: .subDetail) + try type.encode(on: &_container, forKey: .type) + try udi?.encode(on: &_container, forKey: .udi) + try unitPrice?.encode(on: &_container, forKey: .unitPrice) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitItemDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjudication == _other.adjudication + && category == _other.category + && factor == _other.factor + && modifier == _other.modifier + && net == _other.net + && noteNumber == _other.noteNumber + && programCode == _other.programCode + && quantity == _other.quantity + && revenue == _other.revenue + && sequence == _other.sequence + && service == _other.service + && subDetail == _other.subDetail + && type == _other.type + && udi == _other.udi + && unitPrice == _other.unitPrice + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjudication) + hasher.combine(category) + hasher.combine(factor) + hasher.combine(modifier) + hasher.combine(net) + hasher.combine(noteNumber) + hasher.combine(programCode) + hasher.combine(quantity) + hasher.combine(revenue) + hasher.combine(sequence) + hasher.combine(service) + hasher.combine(subDetail) + hasher.combine(type) + hasher.combine(udi) + hasher.combine(unitPrice) + } +} + +/** + Additional items. + + Third tier of goods and services. + */ +open class ExplanationOfBenefitItemDetailSubDetail: BackboneElement { + + /// Service instance + public var sequence: FHIRPrimitive + + /// Type of product or service + public var type: CodeableConcept + + /// Revenue or cost center code + public var revenue: CodeableConcept? + + /// Type of service or product + public var category: CodeableConcept? + + /// Billing Code + public var service: CodeableConcept? + + /// Service/Product billing modifiers + public var modifier: [CodeableConcept]? + + /// Program specific reason for item inclusion + public var programCode: [CodeableConcept]? + + /// Count of Products or Services + public var quantity: Quantity? + + /// Fee, charge or cost per point + public var unitPrice: Money? + + /// Price scaling factor + public var factor: FHIRPrimitive? + + /// Net additional item cost + public var net: Money? + + /// Unique Device Identifier + public var udi: [Reference]? + + /// List of note numbers which apply + public var noteNumber: [FHIRPrimitive]? + + /// Language if different from the resource + public var adjudication: [ExplanationOfBenefitItemAdjudication]? + + /// Designated initializer taking all required properties + public init(sequence: FHIRPrimitive, type: CodeableConcept) { + self.sequence = sequence + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + adjudication: [ExplanationOfBenefitItemAdjudication]? = nil, + category: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + factor: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + modifier: [CodeableConcept]? = nil, + modifierExtension: [Extension]? = nil, + net: Money? = nil, + noteNumber: [FHIRPrimitive]? = nil, + programCode: [CodeableConcept]? = nil, + quantity: Quantity? = nil, + revenue: CodeableConcept? = nil, + sequence: FHIRPrimitive, + service: CodeableConcept? = nil, + type: CodeableConcept, + udi: [Reference]? = nil, + unitPrice: Money? = nil) + { + self.init(sequence: sequence, type: type) + self.adjudication = adjudication + self.category = category + self.`extension` = `extension` + self.factor = factor + self.id = id + self.modifier = modifier + self.modifierExtension = modifierExtension + self.net = net + self.noteNumber = noteNumber + self.programCode = programCode + self.quantity = quantity + self.revenue = revenue + self.service = service + self.udi = udi + self.unitPrice = unitPrice + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjudication + case category + case factor; case _factor + case modifier + case net + case noteNumber; case _noteNumber + case programCode + case quantity + case revenue + case sequence; case _sequence + case service + case type + case udi + case unitPrice + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjudication = try [ExplanationOfBenefitItemAdjudication](from: _container, forKeyIfPresent: .adjudication) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.factor = try FHIRPrimitive(from: _container, forKeyIfPresent: .factor, auxiliaryKey: ._factor) + self.modifier = try [CodeableConcept](from: _container, forKeyIfPresent: .modifier) + self.net = try Money(from: _container, forKeyIfPresent: .net) + self.noteNumber = try [FHIRPrimitive](from: _container, forKeyIfPresent: .noteNumber, auxiliaryKey: ._noteNumber) + self.programCode = try [CodeableConcept](from: _container, forKeyIfPresent: .programCode) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.revenue = try CodeableConcept(from: _container, forKeyIfPresent: .revenue) + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + self.service = try CodeableConcept(from: _container, forKeyIfPresent: .service) + self.type = try CodeableConcept(from: _container, forKey: .type) + self.udi = try [Reference](from: _container, forKeyIfPresent: .udi) + self.unitPrice = try Money(from: _container, forKeyIfPresent: .unitPrice) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjudication?.encode(on: &_container, forKey: .adjudication) + try category?.encode(on: &_container, forKey: .category) + try factor?.encode(on: &_container, forKey: .factor, auxiliaryKey: ._factor) + try modifier?.encode(on: &_container, forKey: .modifier) + try net?.encode(on: &_container, forKey: .net) + try noteNumber?.encode(on: &_container, forKey: .noteNumber, auxiliaryKey: ._noteNumber) + try programCode?.encode(on: &_container, forKey: .programCode) + try quantity?.encode(on: &_container, forKey: .quantity) + try revenue?.encode(on: &_container, forKey: .revenue) + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try service?.encode(on: &_container, forKey: .service) + try type.encode(on: &_container, forKey: .type) + try udi?.encode(on: &_container, forKey: .udi) + try unitPrice?.encode(on: &_container, forKey: .unitPrice) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitItemDetailSubDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjudication == _other.adjudication + && category == _other.category + && factor == _other.factor + && modifier == _other.modifier + && net == _other.net + && noteNumber == _other.noteNumber + && programCode == _other.programCode + && quantity == _other.quantity + && revenue == _other.revenue + && sequence == _other.sequence + && service == _other.service + && type == _other.type + && udi == _other.udi + && unitPrice == _other.unitPrice + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjudication) + hasher.combine(category) + hasher.combine(factor) + hasher.combine(modifier) + hasher.combine(net) + hasher.combine(noteNumber) + hasher.combine(programCode) + hasher.combine(quantity) + hasher.combine(revenue) + hasher.combine(sequence) + hasher.combine(service) + hasher.combine(type) + hasher.combine(udi) + hasher.combine(unitPrice) + } +} + +/** + Party to be paid any benefits payable. + + The party to be reimbursed for the services. + */ +open class ExplanationOfBenefitPayee: BackboneElement { + + /// Type of party: Subscriber, Provider, other + public var type: CodeableConcept? + + /// organization | patient | practitioner | relatedperson + public var resourceType: CodeableConcept? + + /// Party to receive the payable + public var party: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + party: Reference? = nil, + resourceType: CodeableConcept? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.party = party + self.resourceType = resourceType + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case party + case resourceType + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.party = try Reference(from: _container, forKeyIfPresent: .party) + self.resourceType = try CodeableConcept(from: _container, forKeyIfPresent: .resourceType) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try party?.encode(on: &_container, forKey: .party) + try resourceType?.encode(on: &_container, forKey: .resourceType) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitPayee else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return party == _other.party + && resourceType == _other.resourceType + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(party) + hasher.combine(resourceType) + hasher.combine(type) + } +} + +/** + Payment (if paid). + + Payment details for the claim if the claim has been paid. + */ +open class ExplanationOfBenefitPayment: BackboneElement { + + /// Partial or Complete + public var type: CodeableConcept? + + /// Payment adjustment for non-Claim issues + public var adjustment: Money? + + /// Explanation for the non-claim adjustment + public var adjustmentReason: CodeableConcept? + + /// Expected date of Payment + public var date: FHIRPrimitive? + + /// Payable amount after adjustment + public var amount: Money? + + /// Identifier of the payment instrument + public var identifier: Identifier? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + adjustment: Money? = nil, + adjustmentReason: CodeableConcept? = nil, + amount: Money? = nil, + date: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.adjustment = adjustment + self.adjustmentReason = adjustmentReason + self.amount = amount + self.date = date + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case adjustment + case adjustmentReason + case amount + case date; case _date + case identifier + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.adjustment = try Money(from: _container, forKeyIfPresent: .adjustment) + self.adjustmentReason = try CodeableConcept(from: _container, forKeyIfPresent: .adjustmentReason) + self.amount = try Money(from: _container, forKeyIfPresent: .amount) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try adjustment?.encode(on: &_container, forKey: .adjustment) + try adjustmentReason?.encode(on: &_container, forKey: .adjustmentReason) + try amount?.encode(on: &_container, forKey: .amount) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try identifier?.encode(on: &_container, forKey: .identifier) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitPayment else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return adjustment == _other.adjustment + && adjustmentReason == _other.adjustmentReason + && amount == _other.amount + && date == _other.date + && identifier == _other.identifier + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(adjustment) + hasher.combine(adjustmentReason) + hasher.combine(amount) + hasher.combine(date) + hasher.combine(identifier) + hasher.combine(type) + } +} + +/** + Procedures performed. + + Ordered list of patient procedures performed to support the adjudication. + */ +open class ExplanationOfBenefitProcedure: BackboneElement { + + /// All possible types for "procedure[x]" + public enum ProcedureX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Procedure sequence for reference + public var sequence: FHIRPrimitive + + /// When the procedure was performed + public var date: FHIRPrimitive? + + /// Patient's list of procedures performed + /// One of `procedure[x]` + public var procedure: ProcedureX + + /// Designated initializer taking all required properties + public init(procedure: ProcedureX, sequence: FHIRPrimitive) { + self.procedure = procedure + self.sequence = sequence + super.init() + } + + /// Convenience initializer + public convenience init( + date: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + procedure: ProcedureX, + sequence: FHIRPrimitive) + { + self.init(procedure: procedure, sequence: sequence) + self.date = date + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case date; case _date + case procedureCodeableConcept + case procedureReference + case sequence; case _sequence + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.procedureCodeableConcept) || _container.contains(CodingKeys.procedureReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.procedureCodeableConcept, CodingKeys.procedureReference], debugDescription: "Must have at least one value for \"procedure\" but have none")) + } + + // Decode all our properties + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + var _t_procedure: ProcedureX? = nil + if let procedureCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .procedureCodeableConcept) { + if _t_procedure != nil { + throw DecodingError.dataCorruptedError(forKey: .procedureCodeableConcept, in: _container, debugDescription: "More than one value provided for \"procedure\"") + } + _t_procedure = .codeableConcept(procedureCodeableConcept) + } + if let procedureReference = try Reference(from: _container, forKeyIfPresent: .procedureReference) { + if _t_procedure != nil { + throw DecodingError.dataCorruptedError(forKey: .procedureReference, in: _container, debugDescription: "More than one value provided for \"procedure\"") + } + _t_procedure = .reference(procedureReference) + } + self.procedure = _t_procedure! + self.sequence = try FHIRPrimitive(from: _container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + + switch procedure { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .procedureCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .procedureReference) + } + + try sequence.encode(on: &_container, forKey: .sequence, auxiliaryKey: ._sequence) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitProcedure else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return date == _other.date + && procedure == _other.procedure + && sequence == _other.sequence + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(date) + hasher.combine(procedure) + hasher.combine(sequence) + } +} + +/** + Processing notes. + + Note text. + */ +open class ExplanationOfBenefitProcessNote: BackboneElement { + + /// Sequence number for this note + public var number: FHIRPrimitive? + + /// display | print | printoper + public var type: CodeableConcept? + + /// Note explanitory text + public var text: FHIRPrimitive? + + /// Language if different from the resource + public var language: CodeableConcept? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + language: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil, + number: FHIRPrimitive? = nil, + text: FHIRPrimitive? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.language = language + self.modifierExtension = modifierExtension + self.number = number + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case language + case number; case _number + case text; case _text + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.language = try CodeableConcept(from: _container, forKeyIfPresent: .language) + self.number = try FHIRPrimitive(from: _container, forKeyIfPresent: .number, auxiliaryKey: ._number) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try language?.encode(on: &_container, forKey: .language) + try number?.encode(on: &_container, forKey: .number, auxiliaryKey: ._number) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitProcessNote else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return language == _other.language + && number == _other.number + && text == _other.text + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(language) + hasher.combine(number) + hasher.combine(text) + hasher.combine(type) + } +} + +/** + Related Claims which may be revelant to processing this claim. + + Other claims which are related to this claim such as prior claim versions or for related services. + */ +open class ExplanationOfBenefitRelated: BackboneElement { + + /// Reference to the related claim + public var claim: Reference? + + /// How the reference claim is related + public var relationship: CodeableConcept? + + /// Related file or case reference + public var reference: Identifier? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + claim: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reference: Identifier? = nil, + relationship: CodeableConcept? = nil) + { + self.init() + self.claim = claim + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reference = reference + self.relationship = relationship + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case claim + case reference + case relationship + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.claim = try Reference(from: _container, forKeyIfPresent: .claim) + self.reference = try Identifier(from: _container, forKeyIfPresent: .reference) + self.relationship = try CodeableConcept(from: _container, forKeyIfPresent: .relationship) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try claim?.encode(on: &_container, forKey: .claim) + try reference?.encode(on: &_container, forKey: .reference) + try relationship?.encode(on: &_container, forKey: .relationship) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ExplanationOfBenefitRelated else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return claim == _other.claim + && reference == _other.reference + && relationship == _other.relationship + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(claim) + hasher.combine(reference) + hasher.combine(relationship) + } +} diff --git a/Sources/ModelsSTU3/Extension.swift b/Sources/ModelsSTU3/Extension.swift new file mode 100644 index 0000000..edb117b --- /dev/null +++ b/Sources/ModelsSTU3/Extension.swift @@ -0,0 +1,487 @@ +// +// Extension.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Extension) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Optional Extensions Element. + + Optional Extension Element - found in all resources. + */ +open class Extension: Element { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case address(Address) + case age(Age) + case annotation(Annotation) + case attachment(Attachment) + case base64Binary(FHIRPrimitive) + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case coding(Coding) + case contactPoint(ContactPoint) + case count(Count) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case distance(Distance) + case duration(Duration) + case humanName(HumanName) + case id(FHIRPrimitive) + case identifier(Identifier) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case markdown(FHIRPrimitive) + case meta(Meta) + case money(Money) + case oid(FHIRPrimitive) + case period(Period) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case reference(Reference) + case sampledData(SampledData) + case signature(Signature) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case timing(Timing) + case unsignedInt(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// identifies the meaning of the extension + public var url: FHIRPrimitive + + /// Value of extension + /// One of `value[x]` + public var value: ValueX? + + /// Designated initializer taking all required properties + public init(url: FHIRPrimitive) { + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + url: FHIRPrimitive, + value: ValueX? = nil) + { + self.init(url: url) + self.`extension` = `extension` + self.id = id + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case url; case _url + case valueAddress + case valueAge + case valueAnnotation + case valueAttachment + case valueBase64Binary; case _valueBase64Binary + case valueBoolean; case _valueBoolean + case valueCode; case _valueCode + case valueCodeableConcept + case valueCoding + case valueContactPoint + case valueCount + case valueDate; case _valueDate + case valueDateTime; case _valueDateTime + case valueDecimal; case _valueDecimal + case valueDistance + case valueDuration + case valueHumanName + case valueId; case _valueId + case valueIdentifier + case valueInstant; case _valueInstant + case valueInteger; case _valueInteger + case valueMarkdown; case _valueMarkdown + case valueMeta + case valueMoney + case valueOid; case _valueOid + case valuePeriod + case valuePositiveInt; case _valuePositiveInt + case valueQuantity + case valueRange + case valueRatio + case valueReference + case valueSampledData + case valueSignature + case valueString; case _valueString + case valueTime; case _valueTime + case valueTiming + case valueUnsignedInt; case _valueUnsignedInt + case valueUri; case _valueUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + var _t_value: ValueX? = nil + if let valueBase64Binary = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBase64Binary, auxiliaryKey: ._valueBase64Binary) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBase64Binary, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .base64Binary(valueBase64Binary) + } + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueCode, auxiliaryKey: ._valueCode) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCode, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .code(valueCode) + } + if let valueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDate, auxiliaryKey: ._valueDate) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDate, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .date(valueDate) + } + if let valueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDateTime, auxiliaryKey: ._valueDateTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDateTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .dateTime(valueDateTime) + } + if let valueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDecimal, auxiliaryKey: ._valueDecimal) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDecimal, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .decimal(valueDecimal) + } + if let valueId = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueId, auxiliaryKey: ._valueId) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueId, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .id(valueId) + } + if let valueInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInstant, auxiliaryKey: ._valueInstant) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInstant, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .instant(valueInstant) + } + if let valueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInteger, auxiliaryKey: ._valueInteger) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInteger, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .integer(valueInteger) + } + if let valueMarkdown = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueMarkdown, auxiliaryKey: ._valueMarkdown) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMarkdown, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .markdown(valueMarkdown) + } + if let valueOid = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueOid, auxiliaryKey: ._valueOid) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueOid, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .oid(valueOid) + } + if let valuePositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .valuePositiveInt, auxiliaryKey: ._valuePositiveInt) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePositiveInt, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .positiveInt(valuePositiveInt) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueTime, auxiliaryKey: ._valueTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .time(valueTime) + } + if let valueUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUnsignedInt, auxiliaryKey: ._valueUnsignedInt) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUnsignedInt, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .unsignedInt(valueUnsignedInt) + } + if let valueUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUri, auxiliaryKey: ._valueUri) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUri, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .uri(valueUri) + } + if let valueAddress = try Address(from: _container, forKeyIfPresent: .valueAddress) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAddress, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .address(valueAddress) + } + if let valueAge = try Age(from: _container, forKeyIfPresent: .valueAge) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAge, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .age(valueAge) + } + if let valueAnnotation = try Annotation(from: _container, forKeyIfPresent: .valueAnnotation) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAnnotation, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .annotation(valueAnnotation) + } + if let valueAttachment = try Attachment(from: _container, forKeyIfPresent: .valueAttachment) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAttachment, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .attachment(valueAttachment) + } + if let valueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .valueCodeableConcept) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .codeableConcept(valueCodeableConcept) + } + if let valueCoding = try Coding(from: _container, forKeyIfPresent: .valueCoding) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCoding, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .coding(valueCoding) + } + if let valueContactPoint = try ContactPoint(from: _container, forKeyIfPresent: .valueContactPoint) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueContactPoint, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .contactPoint(valueContactPoint) + } + if let valueCount = try Count(from: _container, forKeyIfPresent: .valueCount) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCount, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .count(valueCount) + } + if let valueDistance = try Distance(from: _container, forKeyIfPresent: .valueDistance) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDistance, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .distance(valueDistance) + } + if let valueDuration = try Duration(from: _container, forKeyIfPresent: .valueDuration) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDuration, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .duration(valueDuration) + } + if let valueHumanName = try HumanName(from: _container, forKeyIfPresent: .valueHumanName) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueHumanName, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .humanName(valueHumanName) + } + if let valueIdentifier = try Identifier(from: _container, forKeyIfPresent: .valueIdentifier) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueIdentifier, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .identifier(valueIdentifier) + } + if let valueMoney = try Money(from: _container, forKeyIfPresent: .valueMoney) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMoney, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .money(valueMoney) + } + if let valuePeriod = try Period(from: _container, forKeyIfPresent: .valuePeriod) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePeriod, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .period(valuePeriod) + } + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueRange = try Range(from: _container, forKeyIfPresent: .valueRange) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRange, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .range(valueRange) + } + if let valueRatio = try Ratio(from: _container, forKeyIfPresent: .valueRatio) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRatio, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .ratio(valueRatio) + } + if let valueReference = try Reference(from: _container, forKeyIfPresent: .valueReference) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueReference, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .reference(valueReference) + } + if let valueSampledData = try SampledData(from: _container, forKeyIfPresent: .valueSampledData) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSampledData, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .sampledData(valueSampledData) + } + if let valueSignature = try Signature(from: _container, forKeyIfPresent: .valueSignature) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSignature, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .signature(valueSignature) + } + if let valueTiming = try Timing(from: _container, forKeyIfPresent: .valueTiming) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTiming, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .timing(valueTiming) + } + if let valueMeta = try Meta(from: _container, forKeyIfPresent: .valueMeta) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMeta, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .meta(valueMeta) + } + self.value = _t_value + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + if let _enum = value { + switch _enum { + case .base64Binary(let _value): + try _value.encode(on: &_container, forKey: .valueBase64Binary, auxiliaryKey: ._valueBase64Binary) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .code(let _value): + try _value.encode(on: &_container, forKey: .valueCode, auxiliaryKey: ._valueCode) + case .date(let _value): + try _value.encode(on: &_container, forKey: .valueDate, auxiliaryKey: ._valueDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .valueDateTime, auxiliaryKey: ._valueDateTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .valueDecimal, auxiliaryKey: ._valueDecimal) + case .id(let _value): + try _value.encode(on: &_container, forKey: .valueId, auxiliaryKey: ._valueId) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .valueInstant, auxiliaryKey: ._valueInstant) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .valueInteger, auxiliaryKey: ._valueInteger) + case .markdown(let _value): + try _value.encode(on: &_container, forKey: .valueMarkdown, auxiliaryKey: ._valueMarkdown) + case .oid(let _value): + try _value.encode(on: &_container, forKey: .valueOid, auxiliaryKey: ._valueOid) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .valuePositiveInt, auxiliaryKey: ._valuePositiveInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .time(let _value): + try _value.encode(on: &_container, forKey: .valueTime, auxiliaryKey: ._valueTime) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .valueUnsignedInt, auxiliaryKey: ._valueUnsignedInt) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .valueUri, auxiliaryKey: ._valueUri) + case .address(let _value): + try _value.encode(on: &_container, forKey: .valueAddress) + case .age(let _value): + try _value.encode(on: &_container, forKey: .valueAge) + case .annotation(let _value): + try _value.encode(on: &_container, forKey: .valueAnnotation) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .valueAttachment) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .valueCodeableConcept) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .valueCoding) + case .contactPoint(let _value): + try _value.encode(on: &_container, forKey: .valueContactPoint) + case .count(let _value): + try _value.encode(on: &_container, forKey: .valueCount) + case .distance(let _value): + try _value.encode(on: &_container, forKey: .valueDistance) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .valueDuration) + case .humanName(let _value): + try _value.encode(on: &_container, forKey: .valueHumanName) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .valueIdentifier) + case .money(let _value): + try _value.encode(on: &_container, forKey: .valueMoney) + case .period(let _value): + try _value.encode(on: &_container, forKey: .valuePeriod) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .valueRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .valueRatio) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueReference) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .valueSampledData) + case .signature(let _value): + try _value.encode(on: &_container, forKey: .valueSignature) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .valueTiming) + case .meta(let _value): + try _value.encode(on: &_container, forKey: .valueMeta) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Extension else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return url == _other.url + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(url) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/FHIRAbstractResource.swift b/Sources/ModelsSTU3/FHIRAbstractResource.swift new file mode 100644 index 0000000..866044d --- /dev/null +++ b/Sources/ModelsSTU3/FHIRAbstractResource.swift @@ -0,0 +1,71 @@ +// +// FHIRAbstractResource.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + * Base class for all FHIR resources. + */ +open class FHIRAbstractResource: FHIRType { + + open class var resourceType: ResourceType { return .resource } + + public init() {} + + // MARK: Codable + + private enum ValidKeys: String, CodingKey { + case resourceType + } + /* + public init(from decoder: Decoder) throws { + // We _could_ enforce resourceType checking here, let's rely on ResourceProxy on that for now so we can instantiate custom resources + // as `Resource` + } // */ + + public func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: ValidKeys.self) + try _container.encode(type(of: self).resourceType, forKey: .resourceType) + } + + // MARK: Custom String Convertible + + public var description: String { + return "<\(type(of: self).resourceType)>" + } + + // MARK: Equatable & Hashable + + public static func ==(l: FHIRAbstractResource, r: FHIRAbstractResource) -> Bool { + return l.isEqual(to: r) + } + + public func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? FHIRAbstractResource else { + return false + } + guard type(of: self) == type(of: _other) else { + return false + } + return type(of: self).resourceType == type(of: _other).resourceType + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(type(of: self).resourceType) + } +} diff --git a/Sources/ModelsSTU3/FHIRBool.swift b/Sources/ModelsSTU3/FHIRBool.swift new file mode 100644 index 0000000..9010383 --- /dev/null +++ b/Sources/ModelsSTU3/FHIRBool.swift @@ -0,0 +1,91 @@ +// +// FHIRPrimitive.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A boolean value: true | false + + http://hl7.org/fhir/datatypes.html#boolean + */ +public struct FHIRBool: FHIRPrimitiveType { + + public typealias BooleanLiteralType = Bool + + public var bool: Self.BooleanLiteralType + + /** + Designated initializer. + */ + public init(_ bool: Self.BooleanLiteralType) { + self.bool = bool + } +} + +extension FHIRBool: ExpressibleByBooleanLiteral { + + public init(booleanLiteral value: Self.BooleanLiteralType) { + self.bool = value + } +} + +extension FHIRBool: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + self.bool = try container.decode(Self.BooleanLiteralType.self) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(bool) + } +} + +extension FHIRBool: Equatable { + + public static func ==(l: FHIRBool, r: FHIRBool) -> Bool { + return l.bool == r.bool + } + + public static func ==(l: Bool, r: FHIRBool) -> Bool { + return l == r.bool + } + + public static func ==(l: FHIRBool, r: Bool) -> Bool { + return l.bool == r + } +} + +// MARK: - + +extension Bool { + + public func asPrimitive() -> FHIRPrimitive { + return FHIRPrimitive(FHIRBool(self)) + } +} + +extension FHIRPrimitive: ExpressibleByBooleanLiteral where PrimitiveType == FHIRBool { + + public typealias BooleanLiteralType = Bool + + public init(booleanLiteral value: Self.BooleanLiteralType) { + self.init(FHIRBool(value)) + } +} diff --git a/Sources/ModelsSTU3/FHIRDate.swift b/Sources/ModelsSTU3/FHIRDate.swift new file mode 100644 index 0000000..a7ad7bd --- /dev/null +++ b/Sources/ModelsSTU3/FHIRDate.swift @@ -0,0 +1,167 @@ +// +// FHIRDate.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import FMCore + +/** + A date, or partial date (e.g. just year or year + month) as used in human communication. The format is YYYY, YYYY-MM, + or YYYY-MM-DD, e.g. 2018, 1973-06, or 1905-08-23. There SHALL be no time zone. Dates SHALL be valid dates. + + While DSTU-2 permitted years from -9999 to 9999, R4 only allows years from 0001 to 9999, which is what we'll enforce, + too. + + http://hl7.org/fhir/datatypes.html#date + */ +public struct FHIRDate: FHIRPrimitiveType { + + public var year: Int + + public var month: UInt8? { + didSet { + if let month = month, month > 12 { + self.month = oldValue + } + } + } + + public var day: UInt8? { + didSet { + if let day = day, day > 31 { + self.day = oldValue + } + } + } + + /** + Designated initializer. You can only have a day if you have a month. Day is capped at 31, month is capped at 12. + */ + public init(year: Int, month: UInt8? = nil, day: UInt8? = nil) { + self.year = year + if let month = month, month <= 12 { + self.month = month + if let day = day, day <= 31 { + self.day = day + } + } + } + + public init(_ originalString: String) throws { + let scanner = Scanner(string: originalString) + let (year, month, day) = try FHIRDate.parseComponents(from: scanner) + self.init(year: year, month: month, day: day) + } + + // MARK: Parsing + + /// Parse valid "date" strings. + /// See http://hl7.org/fhir/datatypes.html#date + public static func parseComponents(from scanner: Scanner, expectAtEnd: Bool = true) throws -> (year: Int, month: UInt8?, day: UInt8?) { + let originalCharactersToBeSkipped = scanner.charactersToBeSkipped + defer { scanner.charactersToBeSkipped = originalCharactersToBeSkipped } + scanner.charactersToBeSkipped = nil + let numbers = CharacterSet.decimalDigits + + var scanLocation = scanner.scanLocation + guard let scanned = scanner.hs_scanCharacters(from: numbers), scanned.count == 4, let year = Int(scanned), year > 0 else { + throw FHIRDateParserError.invalidYear(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + var month: UInt8? = nil + var day: UInt8? = nil + if scanner.scanString("-", into: nil) { + scanLocation = scanner.scanLocation + guard let scanned = scanner.hs_scanCharacters(from: numbers), scanned.count == 2, let scanMonth = UInt8(scanned), (1...12).contains(scanMonth) else { + throw FHIRDateParserError.invalidMonth(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + month = scanMonth + + if scanner.scanString("-", into: nil) { + scanLocation = scanner.scanLocation + guard let scanned = scanner.hs_scanCharacters(from: numbers), scanned.count == 2, let scanDay = UInt8(scanned), (1...31).contains(scanDay) else { + throw FHIRDateParserError.invalidDay(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + day = scanDay + } + } + + scanLocation = scanner.scanLocation + if expectAtEnd && !scanner.isAtEnd { // it's OK if we don't `expectAtEnd` but the scanner actually is + throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + return (year, month, day) + } + + public static func parse(from scanner: Scanner, expectAtEnd: Bool = true) throws -> FHIRDate { + let (year, month, day) = try FHIRDate.parseComponents(from: scanner, expectAtEnd: expectAtEnd) + return self.init(year: year, month: month, day: day) + } +} + +// MARK: - + +extension FHIRDate: ExpressibleByStringLiteral { + + public init(stringLiteral value: StringLiteralType) { + try! self.init(value) + } +} + +extension FHIRDate: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + let string = try container.decode(String.self) + try self.init(string) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(description) + } +} + +extension FHIRDate: CustomStringConvertible { + + public var description: String { + if let month = month { + if let day = day { + return String(format: "%04d-%02d-%02d", year, month, day) + } + return String(format: "%04d-%02d", year, month) + } + return String(format: "%04d", year) + } +} + +extension FHIRDate: Equatable { + + public static func ==(l: FHIRDate, r: FHIRDate) -> Bool { + if l.year != r.year { + return false + } + if l.month != r.month { + return false + } + if l.day != r.day { + return false + } + return true + } +} diff --git a/Sources/ModelsSTU3/FHIRDecimal.swift b/Sources/ModelsSTU3/FHIRDecimal.swift new file mode 100644 index 0000000..fdfc340 --- /dev/null +++ b/Sources/ModelsSTU3/FHIRDecimal.swift @@ -0,0 +1,87 @@ +// +// FHIRDecimal.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore +import Foundation + +/** + Rational numbers that have a decimal representation. See below about the precision of the number: + + The precision of the decimal value has significance: + - e.g. 0.010 is regarded as different to 0.01, and the original precision should be preserved + - Implementations SHALL handle decimal values in ways that preserve and respect the precision of the value as + represented for presentation purposes + - Implementations are not required to perform calculations with these numbers differently, though they may choose to do + so (i.e. preserve significance) + - See implementation comments for XML, JSON and RDF + - In object code, implementations that might meet this constraint are GMP implementations or equivalents to Java + BigDecimal that implement arbitrary precision, or a combination of a (64 bit) floating point value with a precision + field + - Note that large and/or highly precise values are extremely rare in medicine. One element where highly precise decimals + may be encountered is the Location coordinates. Irrespective of this, the limits documented in XML Schema apply + + http://hl7.org/fhir/datatypes.html#decimal + */ +public struct FHIRDecimal: FHIRPrimitiveType, ExpressibleByFloatLiteral { + + public typealias FloatLiteralType = Double + + public var decimal: Decimal + + /** + Designated initializer. + */ + public init(_ decimal: Decimal) { + self.decimal = decimal + } + + public init(floatLiteral value: Self.FloatLiteralType) { + self.decimal = Decimal(floatLiteral: value) + } +} + +extension FHIRDecimal: Codable { + + public init(from decoder: Decoder) throws { + // TODO: preserve precision / trailing zeroes + let container = try decoder.singleValueContainer() + self.decimal = try container.decode(Decimal.self) + } + + public func encode(to encoder: Encoder) throws { + // TODO: preserve precision / trailing zeroes + var container = encoder.singleValueContainer() + try container.encode(decimal) + } +} + +extension FHIRDecimal: Equatable { + + public static func ==(l: FHIRDecimal, r: FHIRDecimal) -> Bool { + return l.decimal == r.decimal + } +} + +// MARK: - + +extension Double { + + public func asFHIRDecimalPrimitive() -> FHIRPrimitive { + return FHIRPrimitive(FHIRDecimal(floatLiteral: FHIRDecimal.FloatLiteralType(self))) + } +} diff --git a/Sources/ModelsSTU3/FHIRInteger.swift b/Sources/ModelsSTU3/FHIRInteger.swift new file mode 100644 index 0000000..f7f3bcf --- /dev/null +++ b/Sources/ModelsSTU3/FHIRInteger.swift @@ -0,0 +1,61 @@ +// +// FHIRInteger.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + * A signed integer in the range −2,147,483,648..2,147,483,647 (32-bit; for larger values, use decimal) + * + * http://hl7.org/fhir/datatypes.html#integer + */ +public struct FHIRInteger: FHIRPrimitiveType, FHIRIntegerRepresentable { + + public typealias IntegerLiteralType = Int32 + + public var integer: Self.IntegerLiteralType + + public init(_ integer: Self.IntegerLiteralType) { + self.integer = integer + } + + public init(integerLiteral value: Self.IntegerLiteralType) { + self.integer = value + } +} + +extension FHIRInteger: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + self.integer = try container.decode(Self.IntegerLiteralType.self) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(integer) + } +} + +// MARK: - + +extension Int { + + public func asFHIRIntegerPrimitive() -> FHIRPrimitive { + return FHIRPrimitive(FHIRInteger(FHIRInteger.IntegerLiteralType(self))) + } +} diff --git a/Sources/ModelsSTU3/FHIRPositiveInteger.swift b/Sources/ModelsSTU3/FHIRPositiveInteger.swift new file mode 100644 index 0000000..4ca0f7f --- /dev/null +++ b/Sources/ModelsSTU3/FHIRPositiveInteger.swift @@ -0,0 +1,82 @@ +// +// FHIRInteger.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + * Any positive integer in the range 1..2,147,483,647 (that's only 31 bit because the positive int is a constraint on + * the signed int in FHIR). + * + * http://hl7.org/fhir/datatypes.html#positiveInt + */ +public struct FHIRPositiveInteger: FHIRPrimitiveType, FHIRIntegerRepresentable { + + public typealias IntegerLiteralType = Int32 + + public var integer: Self.IntegerLiteralType { + didSet { + if integer < 1 { + integer = oldValue + } + } + } + + /** + Designated initializer. + */ + public init(_ integer: Self.IntegerLiteralType) { + self.integer = max(1, integer) + } + + /// When initializing with a value < 1, the value will be set to 1 + public init(integerLiteral value: Self.IntegerLiteralType) { + self.integer = max(1, value) + } +} + +extension FHIRPositiveInteger: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + let integer = try container.decode(Self.IntegerLiteralType.self) + if integer < 1 { + throw FHIRPositiveIntegerError.valueIsLessThanOne + } + self.integer = integer + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(integer) + } +} + +// MARK: - + +public enum FHIRPositiveIntegerError: Error { + case valueIsLessThanOne +} + +// MARK: - + +extension Int { + + public func asFHIRPositiveIntegerPrimitive() -> FHIRPrimitive { + return FHIRPrimitive(FHIRPositiveInteger(FHIRPositiveInteger.IntegerLiteralType(self))) + } +} diff --git a/Sources/ModelsSTU3/FHIRPrimitive.swift b/Sources/ModelsSTU3/FHIRPrimitive.swift new file mode 100644 index 0000000..37562c6 --- /dev/null +++ b/Sources/ModelsSTU3/FHIRPrimitive.swift @@ -0,0 +1,309 @@ +// +// FHIRPrimitive.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Protocol for all FHIR primitives. + */ +public protocol FHIRPrimitiveType: FHIRType { +} + +extension FHIRPrimitiveType { + + public func asPrimitive(with id: String? = nil, extension: [Extension]? = nil) -> FHIRPrimitive { + return FHIRPrimitive(self, id: id, extension: `extension`) + } +} + +// MARK: - + +public protocol FHIRPrimitiveProtocol: Codable { + + associatedtype PrimitiveType: FHIRPrimitiveType + + var value: PrimitiveType? { get set } + + var id: String? { get set } + + var `extension`: [Extension]? { get set } + + var isNull: Bool { get } + + var hasPrimitiveData: Bool { get } +} + +// MARK: - FHIRPrimitive + +/** + Wrap any of the FHIR primitive types. + */ +public struct FHIRPrimitive: FHIRPrimitiveProtocol { + + public var value: PrimitiveType? + + public var id: String? + + public var `extension`: [Extension]? + + public init(_ value: PrimitiveType? = nil, id: String? = nil, extension: [Extension]? = nil) { + self.value = value + self.id = id + self.extension = `extension` + } + + /// Returns `true` if the receiver has neither a value nor an id nor extensions + public var isNull: Bool { + return value == nil && id == nil && `extension` == nil + } + + /// Returns `true` if the receiver has either an id or extensions + public var hasPrimitiveData: Bool { + return id != nil || `extension` != nil + } + + /// Convenience debug description + public var primitiveDescription: String { + let valueStr = (value == nil) ? "nil value" : "value=\"\(value!)\"" + let idStr = (id == nil) ? "nil id" : "id=\"\(id!)\"" + let extStr = (`extension` == nil) ? "nil extensions" : "extensions=\"\(`extension`!.count)\"" + return "<\(type(of: self)) \(valueStr), \(idStr), \(extStr)>" + } +} + +extension FHIRPrimitive: Hashable { + + public static func ==(l: FHIRPrimitive, r: FHIRPrimitive) -> Bool { + if l.value != r.value { + return false + } + if l.id != r.id { + return false + } + if l.extension != r.extension { + return false + } + return true + } + + public static func ==(l: FHIRPrimitive, r: PrimitiveType) -> Bool { + return l.value == r + } + + public static func ==(l: PrimitiveType, r: FHIRPrimitive) -> Bool { + return l == r.value + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(value) + hasher.combine(id) + hasher.combine(`extension`) + } +} + +// MARK: - Codable + +extension FHIRPrimitive: Codable { + + private enum CodingKeys: String, CodingKey { + case id + case `extension` + } + + /** + Decode the primitive from the given container. Right now this is tailored for FHIR's JSON representation and it + will look for its value on "key" and id or extensions on "_key". + */ + public init(from parentContainer: KeyedDecodingContainer, forKey key: K, auxiliaryKey: K? = nil) throws { + let value = try parentContainer.decodeIfPresent(PrimitiveType.self, forKey: key) + if let auxiliaryKey = auxiliaryKey, let primitive = try parentContainer.decodeIfPresent(Self.self, forKey: auxiliaryKey) { + self.init(value, id: primitive.id, extension: primitive.extension) + } else if let value = value { + self.init(value) + } else { + throw DecodingError.keyNotFound(key, DecodingError.Context(codingPath: [key], debugDescription: "Must have a value for \"\(key)\" but have none")) + } + } + + /** + Decode the primitive from the given container. Right now this is tailored for FHIR's JSON representation and it + will look for its value on "key" and id or extensions on "_key". + */ + public init?(from parentContainer: KeyedDecodingContainer, forKeyIfPresent key: K, auxiliaryKey: K? = nil) throws { + let value = try parentContainer.decodeIfPresent(PrimitiveType.self, forKey: key) + if let auxiliaryKey = auxiliaryKey, let primitive = try parentContainer.decodeIfPresent(Self.self, forKey: auxiliaryKey) { + self.init(value, id: primitive.id, extension: primitive.extension) + } else if let value = value { + self.init(value) + } else { + return nil + } + } + + /** + Encode the primitive to the given parent container. Right now this is tailored for FHIR's JSON representation and + will encode its value to "key" and its id and/or extension, if any, to "_key" given with auxiliaryKey. + */ + public func encode(on parentContainer: inout KeyedEncodingContainer, forKey key: K, auxiliaryKey: K? = nil) throws { + if let value = value { + try parentContainer.encode(value, forKey: key) + } + if hasPrimitiveData { + if let auxiliaryKey = auxiliaryKey { + try parentContainer.encode(self, forKey: auxiliaryKey) + } else { + throw EncodingError.invalidValue(self, EncodingError.Context(codingPath: [key], debugDescription: "Have id or extension but was not provided an encoding key to serialize to")) + } + } + } +} + +// MARK: - Array + +extension Array where Element: FHIRPrimitiveProtocol { + + public init(from parentContainer: KeyedDecodingContainer, forKey key: K, auxiliaryKey: K? = nil) throws { + // This is thorny. See testDecodePrimitiveArrayWithID() and testDecodePrimitiveArrayWithOnlyExtension() + let values = try parentContainer.decodeIfPresent([Element.PrimitiveType?].self, forKey: key) + let primitives = (auxiliaryKey != nil) ? try parentContainer.decodeIfPresent([Element?].self, forKey: auxiliaryKey!) : nil + if let values = values { + if let primitives = primitives { + var arr: [Element] = [] + for (i, v) in values.enumerated() { + let p = primitives[safe: i] + if let v = v { + arr.append(v.asPrimitive(with: p??.id, extension: p??.extension) as! Element) + } else if let pidx = p, let p = pidx { + arr.append(p) + } + } + self = arr + } else { + self = values.compactMap { $0?.asPrimitive() as? Element } + } + } else if let primitives = primitives { + self = primitives.compactMap { $0 } + } else { + throw DecodingError.keyNotFound(key, DecodingError.Context(codingPath: [key], debugDescription: "Must have a value for \"\(key)\" but have none")) + } + } + + public init?(from parentContainer: KeyedDecodingContainer, forKeyIfPresent key: K, auxiliaryKey: K? = nil) throws { + // This is thorny. See testDecodePrimitiveArrayWithID() and testDecodePrimitiveArrayWithOnlyExtension() + let values = try parentContainer.decodeIfPresent([Element.PrimitiveType?].self, forKey: key) + let primitives = (auxiliaryKey != nil) ? try parentContainer.decodeIfPresent([Element?].self, forKey: auxiliaryKey!) : nil + if let values = values { + if let primitives = primitives { + var arr: [Element] = [] + for (i, v) in values.enumerated() { + let p = primitives[safe: i] + if let v = v { + arr.append(v.asPrimitive(with: p??.id, extension: p??.extension) as! Element) + } else if let pidx = p, let p = pidx { + arr.append(p) + } + } + self = arr + } else { + self = values.compactMap { $0?.asPrimitive() as? Element } + } + } else if let primitives = primitives { + self = primitives.compactMap { $0 } + } else { + return nil + } + } + + public func encode(on parentContainer: inout KeyedEncodingContainer, forKey key: K, auxiliaryKey: K? = nil) throws { + var values = [Element.PrimitiveType?]() + var primitives = [Element?]() + var hasNonnullValues = false + var hasNonnullPrimitives = false + for element in self { + guard !element.isNull else { + continue + } + values.append(element.value) + primitives.append(element.hasPrimitiveData ? element : nil) + hasNonnullValues = hasNonnullValues || (element.value != nil) + hasNonnullPrimitives = hasNonnullPrimitives || element.hasPrimitiveData + } + + if hasNonnullValues { + try parentContainer.encode(values, forKey: key) + } + if hasNonnullPrimitives { + if let auxiliaryKey = auxiliaryKey { + try parentContainer.encode(primitives, forKey: auxiliaryKey) + } else { + throw EncodingError.invalidValue(self, EncodingError.Context(codingPath: [key], debugDescription: "Have id or extension elements but was not provided an encoding key to serialize to")) + } + } + } +} + +extension Collection { + + subscript(safe index: Index) -> Iterator.Element? { + guard indices.contains(index) else { + return nil + } + return self[index] + } +} + +// MARK: - ExpressibleByLiteral + +extension FHIRPrimitive: ExpressibleByStringLiteral, ExpressibleByUnicodeScalarLiteral, ExpressibleByExtendedGraphemeClusterLiteral where PrimitiveType: ExpressibleByStringLiteral { + + public typealias StringLiteralType = PrimitiveType.StringLiteralType + + public typealias UnicodeScalarLiteralType = PrimitiveType.UnicodeScalarLiteralType + + public typealias ExtendedGraphemeClusterLiteralType = PrimitiveType.ExtendedGraphemeClusterLiteralType + + public init(stringLiteral value: StringLiteralType) { + self.init(PrimitiveType(stringLiteral: value)) + } + + public init(unicodeScalarLiteral value: PrimitiveType.UnicodeScalarLiteralType) { + self.init(PrimitiveType(unicodeScalarLiteral: value)) + } + + public init(extendedGraphemeClusterLiteral value: PrimitiveType.ExtendedGraphemeClusterLiteralType) { + self.init(PrimitiveType(extendedGraphemeClusterLiteral: value)) + } +} + +extension FHIRPrimitive: ExpressibleByIntegerLiteral where PrimitiveType: ExpressibleByIntegerLiteral { + + public typealias IntegerLiteralType = PrimitiveType.IntegerLiteralType + + public init(integerLiteral value: PrimitiveType.IntegerLiteralType) { + self.init(PrimitiveType(integerLiteral: value)) + } +} + +extension FHIRPrimitive: ExpressibleByFloatLiteral where PrimitiveType: ExpressibleByFloatLiteral { + + public typealias FloatLiteralType = PrimitiveType.FloatLiteralType + + public init(floatLiteral value: PrimitiveType.FloatLiteralType) { + self.init(PrimitiveType(floatLiteral: value)) + } +} diff --git a/Sources/ModelsSTU3/FHIRString.swift b/Sources/ModelsSTU3/FHIRString.swift new file mode 100644 index 0000000..8582942 --- /dev/null +++ b/Sources/ModelsSTU3/FHIRString.swift @@ -0,0 +1,109 @@ +// +// FHIRString.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Class to represent FHIR primitives representing "string", "code", "id", "markdown" and "xhtml", officially: + + A sequence of Unicode characters + + Note that strings SHALL NOT exceed 1MB (1024*1024 characters) in size. Strings SHOULD not contain Unicode character + points below 32, except for u0009 (horizontal tab), u0010 (carriage return) and u0013 (line feed). Leading and Trailing + whitespace is allowed, but SHOULD be removed when using the XML format. Note: This means that a string that consists + only of whitespace could be trimmed to nothing, which would be treated as an invalid element value. Therefore strings + SHOULD always contain non-whitespace content + + http://hl7.org/fhir/datatypes.html#string + http://hl7.org/fhir/datatypes.html#code + + For `id`: Any combination of upper- or lower-case ASCII letters ('A'..'Z', and 'a'..'z', numerals ('0'..'9'), '-' and + '.', with a length limit of 64 characters. (This might be an integer, an un-prefixed OID, UUID or any other identifier + pattern that meets these constraints.). + + Regex: [A-Za-z0-9\-\.]{1,64} + + http://hl7.org/fhir/datatypes.html#id + + For `markdown`: A FHIR string that may contain markdown syntax for optional processing by a markdown presentation + engine, in the GFM extension of CommonMark format. + + http://hl7.org/fhir/datatypes.html#markdown + */ +public struct FHIRString: FHIRPrimitiveType { + + public var string: String + + /** + Designated initializer. + */ + public init(_ string: String) { + self.string = string + } +} + +extension FHIRString: ExpressibleByStringLiteral { + + public init(stringLiteral value: StringLiteralType) { + self.init(value) + } +} + +extension FHIRString: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + self.string = try container.decode(String.self) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(string) + } +} + +extension FHIRString: CustomStringConvertible { + + public var description: String { + return string + } +} + +extension FHIRString: Equatable { + + public static func ==(l: FHIRString, r: FHIRString) -> Bool { + return l.string == r.string + } + + public static func ==(l: String, r: FHIRString) -> Bool { + return l == r.string + } + + public static func ==(l: FHIRString, r: String) -> Bool { + return l.string == r + } +} + +// MARK: - + +extension String { + + public func asFHIRStringPrimitive() -> FHIRPrimitive { + return FHIRPrimitive(FHIRString(self)) + } +} diff --git a/Sources/ModelsSTU3/FHIRTime.swift b/Sources/ModelsSTU3/FHIRTime.swift new file mode 100644 index 0000000..152b921 --- /dev/null +++ b/Sources/ModelsSTU3/FHIRTime.swift @@ -0,0 +1,232 @@ +// +// FHIRTime.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import FMCore + +/** + A time during the day, in the format hh:mm:ss. There is no date specified. Seconds must be provided due to schema type + constraints but may be zero-filled and may be ignored at receiver discretion. The time "24:00" SHALL NOT be used. A + time zone SHALL NOT be present. Times can be converted to a Duration since midnight. + + While DSTU-2 did not allow "60" seconds (the leap second), this is allowed in R4 and we're gonna allow it here, too. + + http://hl7.org/fhir/datatypes.html#time + */ +public struct FHIRTime: FHIRPrimitiveType { + + private var _secondsAreUnaltered = true + + public var hour: UInt8 { + didSet { + if hour > 23 { + hour = 23 + } + } + } + + public var minute: UInt8 { + didSet { + if minute > 59 { + minute = 59 + } + } + } + + public var second: Decimal { + didSet { + if second > 60 { + second = 60.0 + } + _secondsAreUnaltered = false + } + } + + public let originalSecondsString: String? + + /** + Preferred initializer. Hour is capped at 23, minute at 59 and second is capped at 60.0. If you supply higher + values they will independently be set to that maximum value. + */ + public init(hour: UInt8, minute: UInt8, second: Decimal) { + self.init(hour: hour, minute: minute, second: second, originalSecondsString: nil) + } + + public init(_ originalString: String) throws { + let scanner = Scanner(string: originalString) + let (hour, minute, second, originalSecondsString) = try FHIRTime.parseComponents(from: scanner) + self.init(hour: hour, minute: minute, second: second, originalSecondsString: originalSecondsString) + } + + /** + Designated, private initializer. Hour is capped at 23, minute at 59 and second is capped at 60.0. If you supply + higher values they will independently be set to that maximum value. + */ + private init(hour: UInt8, minute: UInt8, second: Decimal, originalSecondsString: String? = nil) { + self.hour = (hour <= 23) ? hour : 23 + self.minute = (minute <= 59) ? minute : 59 + self.second = (second <= 60.0) ? second : 60.0 + self.originalSecondsString = originalSecondsString + } + + // MARK: Parsing + + /// Parse valid "time" strings. + /// See http://hl7.org/fhir/datatypes.html#time + public static func parseComponents(from scanner: Scanner, expectAtEnd: Bool = true) throws -> (hour: UInt8, minute: UInt8, second: Decimal, originalSecondString: String) { + let originalCharactersToBeSkipped = scanner.charactersToBeSkipped + defer { scanner.charactersToBeSkipped = originalCharactersToBeSkipped } + scanner.charactersToBeSkipped = nil + let numbers = CharacterSet.decimalDigits + + // Hours + var scanLocation = scanner.scanLocation + guard let hourString = scanner.hs_scanCharacters(from: numbers) else { + throw FHIRDateParserError.invalidHour(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + guard hourString.count == 2 else { + throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation + hourString.count)) + } + guard let hour = UInt8(hourString), hour <= 23 else { + throw FHIRDateParserError.invalidHour(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + scanLocation = scanner.scanLocation + guard scanner.scanString(":", into: nil) else { + throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + // Minutes + scanLocation = scanner.scanLocation + guard let minuteString = scanner.hs_scanCharacters(from: numbers) else { + throw FHIRDateParserError.invalidMinute(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + guard minuteString.count == 2 else { + throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation + minuteString.count)) + } + guard let minute = UInt8(minuteString), minute <= 59 else { + throw FHIRDateParserError.invalidMinute(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + scanLocation = scanner.scanLocation + guard scanner.scanString(":", into: nil) else { + throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + // Seconds + scanLocation = scanner.scanLocation + guard let fullSecondString = scanner.hs_scanCharacters(from: numbers) else { + throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + guard fullSecondString.count == 2 else { + throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation + fullSecondString.count)) + } + guard let scanSecondAlone = Int(fullSecondString), scanSecondAlone <= 60 else { + throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + let secondString: String + scanLocation = scanner.scanLocation + if scanner.scanString(".", into: nil) { + scanLocation = scanner.scanLocation + guard let subSecondString = scanner.hs_scanCharacters(from: numbers) else { + throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + secondString = "\(fullSecondString).\(subSecondString)" + } else { + secondString = fullSecondString + } + guard let second = Decimal(string: secondString), second <= 60.0 else { + throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + // End + scanLocation = scanner.scanLocation + if expectAtEnd && !scanner.isAtEnd { // it's OK if we don't `expectAtEnd` but the scanner actually is + throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + return (hour, minute, second, secondString) + } + + public static func parse(from scanner: Scanner, expectAtEnd: Bool = true) throws -> FHIRTime { + let (hour, minute, second, originalSecondsString) = try FHIRTime.parseComponents(from: scanner, expectAtEnd: expectAtEnd) + return self.init(hour: hour, minute: minute, second: second, originalSecondsString: originalSecondsString) + } +} + +// MARK: - + +extension FHIRTime: ExpressibleByStringLiteral { + + public init(stringLiteral value: StringLiteralType) { + try! self.init(value) + } +} + +extension FHIRTime: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + let string = try container.decode(String.self) + try self.init(string) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(description) + } +} + +extension FHIRTime: CustomStringConvertible { + + static let secondFormatter: NumberFormatter = { + let formatter = NumberFormatter() + formatter.allowsFloats = true + formatter.maximumIntegerDigits = 2 + formatter.minimumIntegerDigits = 2 + formatter.alwaysShowsDecimalSeparator = false + formatter.minimumFractionDigits = 0 + formatter.maximumFractionDigits = 15 // cannot do `.max` + + return formatter + }() + + public var description: String { + if _secondsAreUnaltered, let originalSecondsString = originalSecondsString { + return String(format: "%02d:%02d:%@", hour, minute, originalSecondsString) + } + return String(format: "%02d:%02d:%@", hour, minute, FHIRTime.secondFormatter.string(for: second) ?? "00") + } +} + +extension FHIRTime: Equatable { + + public static func ==(l: FHIRTime, r: FHIRTime) -> Bool { + if l.hour != r.hour { + return false + } + if l.minute != r.minute { + return false + } + if l.second != r.second { + return false + } + return true + } +} diff --git a/Sources/ModelsSTU3/FHIRURI.swift b/Sources/ModelsSTU3/FHIRURI.swift new file mode 100644 index 0000000..1b5eda3 --- /dev/null +++ b/Sources/ModelsSTU3/FHIRURI.swift @@ -0,0 +1,112 @@ +// +// FHIRURI.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore +import Foundation + +/** + A Uniform Resource Identifier Reference (RFC 3986). Note: URIs are case sensitive. + + This class represents all FHIR `uri` datatypes: + - http://hl7.org/fhir/datatypes.html#uri + - http://hl7.org/fhir/datatypes.html#url + - http://hl7.org/fhir/datatypes.html#uuid + - http://hl7.org/fhir/datatypes.html#oid + + For UUID (aka GUID) (`urn:uuid:53fefa32-fcbb-4ff8-8a92-55ee120877b7`) use all lowercase + */ +public struct FHIRURI: FHIRPrimitiveType { + + public var url: URL + + /** + Designated initializer. + */ + public init(_ url: URL) { + self.url = url + } +} + +extension FHIRURI: ExpressibleByStringLiteral { + + public init(stringLiteral value: StringLiteralType) { + let url = URL(string: value) ?? URL(string: "invalid:uri")! + self.init(url) + } +} + +extension FHIRURI: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + self.url = try container.decode(URL.self) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(url) + } +} + +extension FHIRURI: CustomStringConvertible { + + public var description: String { + return url.absoluteString + } +} + +extension FHIRURI: Equatable { + + public static func ==(l: FHIRURI, r: FHIRURI) -> Bool { + return l.url == r.url + } + + public static func ==(l: URL, r: FHIRURI) -> Bool { + return l == r.url + } + + public static func ==(l: FHIRURI, r: URL) -> Bool { + return l.url == r + } +} + +// MARK: - + +extension String { + + public func asFHIRURI() -> FHIRURI? { + guard let url = URL(string: self) else { + return nil + } + return FHIRURI(url) + } + + public func asFHIRURIPrimitive() -> FHIRPrimitive? { + guard let uri = asFHIRURI() else { + return nil + } + return FHIRPrimitive(uri) + } +} + +extension URL { + + public func asFHIRURIPrimitive() -> FHIRPrimitive { + return FHIRPrimitive(FHIRURI(self)) + } +} diff --git a/Sources/ModelsSTU3/FHIRUnsignedInteger.swift b/Sources/ModelsSTU3/FHIRUnsignedInteger.swift new file mode 100644 index 0000000..bed3089 --- /dev/null +++ b/Sources/ModelsSTU3/FHIRUnsignedInteger.swift @@ -0,0 +1,82 @@ +// +// FHIRInteger.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Any non-negative integer in the range 0..2,147,483,647 (that's only 31 bit because the positive int is a constraint + on the signed int in FHIR). + + http://hl7.org/fhir/datatypes.html#unsignedInt + */ +public struct FHIRUnsignedInteger: FHIRPrimitiveType, FHIRIntegerRepresentable { + + public typealias IntegerLiteralType = Int32 + + public var integer: Self.IntegerLiteralType { + didSet { + if integer < 0 { + integer = oldValue + } + } + } + + /** + Designated initializer. + */ + public init(_ integer: Self.IntegerLiteralType) { + self.integer = max(0, integer) + } + + /// When initializing with a value < 0, the value will be set to 0 + public init(integerLiteral value: Self.IntegerLiteralType) { + self.integer = max(0, value) + } +} + +extension FHIRUnsignedInteger: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + let integer = try container.decode(Self.IntegerLiteralType.self) + if integer < 0 { + throw FHIRUnsignedIntegerError.valueIsLessThanZero + } + self.integer = integer + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(integer) + } +} + +// MARK: - + +public enum FHIRUnsignedIntegerError: Error { + case valueIsLessThanZero +} + +// MARK: - + +extension Int { + + public func asFHIRUnsignedIntegerPrimitive() -> FHIRPrimitive { + return FHIRPrimitive(FHIRUnsignedInteger(FHIRUnsignedInteger.IntegerLiteralType(self))) + } +} diff --git a/Sources/ModelsSTU3/FamilyMemberHistory.swift b/Sources/ModelsSTU3/FamilyMemberHistory.swift new file mode 100644 index 0000000..70ee09c --- /dev/null +++ b/Sources/ModelsSTU3/FamilyMemberHistory.swift @@ -0,0 +1,560 @@ +// +// FamilyMemberHistory.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Information about patient's relatives, relevant for patient. + + Significant health events and conditions for a person related to the patient relevant in the context of care for the + patient. + */ +open class FamilyMemberHistory: DomainResource { + + override open class var resourceType: ResourceType { return .familyMemberHistory } + + /// All possible types for "age[x]" + public enum AgeX: Hashable { + case age(Age) + case range(Range) + case string(FHIRPrimitive) + } + + /// All possible types for "born[x]" + public enum BornX: Hashable { + case date(FHIRPrimitive) + case period(Period) + case string(FHIRPrimitive) + } + + /// All possible types for "deceased[x]" + public enum DeceasedX: Hashable { + case age(Age) + case boolean(FHIRPrimitive) + case date(FHIRPrimitive) + case range(Range) + case string(FHIRPrimitive) + } + + /// External Id(s) for this record + public var identifier: [Identifier]? + + /// Instantiates protocol or definition + public var definition: [Reference]? + + /// A code specifying the status of the record of the family history of a specific family member. + public var status: FHIRPrimitive + + /// The taking of a family member's history did not occur + public var notDone: FHIRPrimitive? + + /// subject-unknown | withheld | unable-to-obtain | deferred + public var notDoneReason: CodeableConcept? + + /// Patient history is about + public var patient: Reference + + /// When history was captured/updated + public var date: FHIRPrimitive? + + /// The family member described + public var name: FHIRPrimitive? + + /// Relationship to the subject + public var relationship: CodeableConcept + + /// Administrative Gender - the gender that the relative is considered to have for administration and record keeping + /// purposes. + public var gender: FHIRPrimitive? + + /// (approximate) date of birth + /// One of `born[x]` + public var born: BornX? + + /// (approximate) age + /// One of `age[x]` + public var age: AgeX? + + /// Age is estimated? + public var estimatedAge: FHIRPrimitive? + + /// Dead? How old/when? + /// One of `deceased[x]` + public var deceased: DeceasedX? + + /// Why was family member history performed? + public var reasonCode: [CodeableConcept]? + + /// Why was family member history performed? + public var reasonReference: [Reference]? + + /// General note about related person + public var note: [Annotation]? + + /// Condition that the related person had + public var condition: [FamilyMemberHistoryCondition]? + + /// Designated initializer taking all required properties + public init(patient: Reference, relationship: CodeableConcept, status: FHIRPrimitive) { + self.patient = patient + self.relationship = relationship + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + age: AgeX? = nil, + born: BornX? = nil, + condition: [FamilyMemberHistoryCondition]? = nil, + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + deceased: DeceasedX? = nil, + definition: [Reference]? = nil, + estimatedAge: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + gender: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + notDone: FHIRPrimitive? = nil, + notDoneReason: CodeableConcept? = nil, + note: [Annotation]? = nil, + patient: Reference, + reasonCode: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + relationship: CodeableConcept, + status: FHIRPrimitive, + text: Narrative? = nil) + { + self.init(patient: patient, relationship: relationship, status: status) + self.age = age + self.born = born + self.condition = condition + self.contained = contained + self.date = date + self.deceased = deceased + self.definition = definition + self.estimatedAge = estimatedAge + self.`extension` = `extension` + self.gender = gender + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.notDone = notDone + self.notDoneReason = notDoneReason + self.note = note + self.reasonCode = reasonCode + self.reasonReference = reasonReference + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case ageAge + case ageRange + case ageString; case _ageString + case bornDate; case _bornDate + case bornPeriod + case bornString; case _bornString + case condition + case date; case _date + case deceasedAge + case deceasedBoolean; case _deceasedBoolean + case deceasedDate; case _deceasedDate + case deceasedRange + case deceasedString; case _deceasedString + case definition + case estimatedAge; case _estimatedAge + case gender; case _gender + case identifier + case name; case _name + case notDone; case _notDone + case notDoneReason + case note + case patient + case reasonCode + case reasonReference + case relationship + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_age: AgeX? = nil + if let ageAge = try Age(from: _container, forKeyIfPresent: .ageAge) { + if _t_age != nil { + throw DecodingError.dataCorruptedError(forKey: .ageAge, in: _container, debugDescription: "More than one value provided for \"age\"") + } + _t_age = .age(ageAge) + } + if let ageRange = try Range(from: _container, forKeyIfPresent: .ageRange) { + if _t_age != nil { + throw DecodingError.dataCorruptedError(forKey: .ageRange, in: _container, debugDescription: "More than one value provided for \"age\"") + } + _t_age = .range(ageRange) + } + if let ageString = try FHIRPrimitive(from: _container, forKeyIfPresent: .ageString, auxiliaryKey: ._ageString) { + if _t_age != nil { + throw DecodingError.dataCorruptedError(forKey: .ageString, in: _container, debugDescription: "More than one value provided for \"age\"") + } + _t_age = .string(ageString) + } + self.age = _t_age + var _t_born: BornX? = nil + if let bornPeriod = try Period(from: _container, forKeyIfPresent: .bornPeriod) { + if _t_born != nil { + throw DecodingError.dataCorruptedError(forKey: .bornPeriod, in: _container, debugDescription: "More than one value provided for \"born\"") + } + _t_born = .period(bornPeriod) + } + if let bornDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .bornDate, auxiliaryKey: ._bornDate) { + if _t_born != nil { + throw DecodingError.dataCorruptedError(forKey: .bornDate, in: _container, debugDescription: "More than one value provided for \"born\"") + } + _t_born = .date(bornDate) + } + if let bornString = try FHIRPrimitive(from: _container, forKeyIfPresent: .bornString, auxiliaryKey: ._bornString) { + if _t_born != nil { + throw DecodingError.dataCorruptedError(forKey: .bornString, in: _container, debugDescription: "More than one value provided for \"born\"") + } + _t_born = .string(bornString) + } + self.born = _t_born + self.condition = try [FamilyMemberHistoryCondition](from: _container, forKeyIfPresent: .condition) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + var _t_deceased: DeceasedX? = nil + if let deceasedBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .deceasedBoolean, auxiliaryKey: ._deceasedBoolean) { + if _t_deceased != nil { + throw DecodingError.dataCorruptedError(forKey: .deceasedBoolean, in: _container, debugDescription: "More than one value provided for \"deceased\"") + } + _t_deceased = .boolean(deceasedBoolean) + } + if let deceasedAge = try Age(from: _container, forKeyIfPresent: .deceasedAge) { + if _t_deceased != nil { + throw DecodingError.dataCorruptedError(forKey: .deceasedAge, in: _container, debugDescription: "More than one value provided for \"deceased\"") + } + _t_deceased = .age(deceasedAge) + } + if let deceasedRange = try Range(from: _container, forKeyIfPresent: .deceasedRange) { + if _t_deceased != nil { + throw DecodingError.dataCorruptedError(forKey: .deceasedRange, in: _container, debugDescription: "More than one value provided for \"deceased\"") + } + _t_deceased = .range(deceasedRange) + } + if let deceasedDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .deceasedDate, auxiliaryKey: ._deceasedDate) { + if _t_deceased != nil { + throw DecodingError.dataCorruptedError(forKey: .deceasedDate, in: _container, debugDescription: "More than one value provided for \"deceased\"") + } + _t_deceased = .date(deceasedDate) + } + if let deceasedString = try FHIRPrimitive(from: _container, forKeyIfPresent: .deceasedString, auxiliaryKey: ._deceasedString) { + if _t_deceased != nil { + throw DecodingError.dataCorruptedError(forKey: .deceasedString, in: _container, debugDescription: "More than one value provided for \"deceased\"") + } + _t_deceased = .string(deceasedString) + } + self.deceased = _t_deceased + self.definition = try [Reference](from: _container, forKeyIfPresent: .definition) + self.estimatedAge = try FHIRPrimitive(from: _container, forKeyIfPresent: .estimatedAge, auxiliaryKey: ._estimatedAge) + self.gender = try FHIRPrimitive(from: _container, forKeyIfPresent: .gender, auxiliaryKey: ._gender) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.notDone = try FHIRPrimitive(from: _container, forKeyIfPresent: .notDone, auxiliaryKey: ._notDone) + self.notDoneReason = try CodeableConcept(from: _container, forKeyIfPresent: .notDoneReason) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.patient = try Reference(from: _container, forKey: .patient) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.relationship = try CodeableConcept(from: _container, forKey: .relationship) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = age { + switch _enum { + case .age(let _value): + try _value.encode(on: &_container, forKey: .ageAge) + case .range(let _value): + try _value.encode(on: &_container, forKey: .ageRange) + case .string(let _value): + try _value.encode(on: &_container, forKey: .ageString, auxiliaryKey: ._ageString) + } + } + if let _enum = born { + switch _enum { + case .period(let _value): + try _value.encode(on: &_container, forKey: .bornPeriod) + case .date(let _value): + try _value.encode(on: &_container, forKey: .bornDate, auxiliaryKey: ._bornDate) + case .string(let _value): + try _value.encode(on: &_container, forKey: .bornString, auxiliaryKey: ._bornString) + } + } + try condition?.encode(on: &_container, forKey: .condition) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + if let _enum = deceased { + switch _enum { + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .deceasedBoolean, auxiliaryKey: ._deceasedBoolean) + case .age(let _value): + try _value.encode(on: &_container, forKey: .deceasedAge) + case .range(let _value): + try _value.encode(on: &_container, forKey: .deceasedRange) + case .date(let _value): + try _value.encode(on: &_container, forKey: .deceasedDate, auxiliaryKey: ._deceasedDate) + case .string(let _value): + try _value.encode(on: &_container, forKey: .deceasedString, auxiliaryKey: ._deceasedString) + } + } + try definition?.encode(on: &_container, forKey: .definition) + try estimatedAge?.encode(on: &_container, forKey: .estimatedAge, auxiliaryKey: ._estimatedAge) + try gender?.encode(on: &_container, forKey: .gender, auxiliaryKey: ._gender) + try identifier?.encode(on: &_container, forKey: .identifier) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try notDone?.encode(on: &_container, forKey: .notDone, auxiliaryKey: ._notDone) + try notDoneReason?.encode(on: &_container, forKey: .notDoneReason) + try note?.encode(on: &_container, forKey: .note) + try patient.encode(on: &_container, forKey: .patient) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try relationship.encode(on: &_container, forKey: .relationship) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? FamilyMemberHistory else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return age == _other.age + && born == _other.born + && condition == _other.condition + && date == _other.date + && deceased == _other.deceased + && definition == _other.definition + && estimatedAge == _other.estimatedAge + && gender == _other.gender + && identifier == _other.identifier + && name == _other.name + && notDone == _other.notDone + && notDoneReason == _other.notDoneReason + && note == _other.note + && patient == _other.patient + && reasonCode == _other.reasonCode + && reasonReference == _other.reasonReference + && relationship == _other.relationship + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(age) + hasher.combine(born) + hasher.combine(condition) + hasher.combine(date) + hasher.combine(deceased) + hasher.combine(definition) + hasher.combine(estimatedAge) + hasher.combine(gender) + hasher.combine(identifier) + hasher.combine(name) + hasher.combine(notDone) + hasher.combine(notDoneReason) + hasher.combine(note) + hasher.combine(patient) + hasher.combine(reasonCode) + hasher.combine(reasonReference) + hasher.combine(relationship) + hasher.combine(status) + } +} + +/** + Condition that the related person had. + + The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to + represent more than one condition per resource, though there is nothing stopping multiple resources - one per + condition. + */ +open class FamilyMemberHistoryCondition: BackboneElement { + + /// All possible types for "onset[x]" + public enum OnsetX: Hashable { + case age(Age) + case period(Period) + case range(Range) + case string(FHIRPrimitive) + } + + /// Condition suffered by relation + public var code: CodeableConcept + + /// deceased | permanent disability | etc. + public var outcome: CodeableConcept? + + /// When condition first manifested + /// One of `onset[x]` + public var onset: OnsetX? + + /// Extra information about condition + public var note: [Annotation]? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + onset: OnsetX? = nil, + outcome: CodeableConcept? = nil) + { + self.init(code: code) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.note = note + self.onset = onset + self.outcome = outcome + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case note + case onsetAge + case onsetPeriod + case onsetRange + case onsetString; case _onsetString + case outcome + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKey: .code) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + var _t_onset: OnsetX? = nil + if let onsetAge = try Age(from: _container, forKeyIfPresent: .onsetAge) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetAge, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .age(onsetAge) + } + if let onsetRange = try Range(from: _container, forKeyIfPresent: .onsetRange) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetRange, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .range(onsetRange) + } + if let onsetPeriod = try Period(from: _container, forKeyIfPresent: .onsetPeriod) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetPeriod, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .period(onsetPeriod) + } + if let onsetString = try FHIRPrimitive(from: _container, forKeyIfPresent: .onsetString, auxiliaryKey: ._onsetString) { + if _t_onset != nil { + throw DecodingError.dataCorruptedError(forKey: .onsetString, in: _container, debugDescription: "More than one value provided for \"onset\"") + } + _t_onset = .string(onsetString) + } + self.onset = _t_onset + self.outcome = try CodeableConcept(from: _container, forKeyIfPresent: .outcome) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code) + try note?.encode(on: &_container, forKey: .note) + if let _enum = onset { + switch _enum { + case .age(let _value): + try _value.encode(on: &_container, forKey: .onsetAge) + case .range(let _value): + try _value.encode(on: &_container, forKey: .onsetRange) + case .period(let _value): + try _value.encode(on: &_container, forKey: .onsetPeriod) + case .string(let _value): + try _value.encode(on: &_container, forKey: .onsetString, auxiliaryKey: ._onsetString) + } + } + try outcome?.encode(on: &_container, forKey: .outcome) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? FamilyMemberHistoryCondition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && note == _other.note + && onset == _other.onset + && outcome == _other.outcome + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(note) + hasher.combine(onset) + hasher.combine(outcome) + } +} diff --git a/Sources/ModelsSTU3/Flag.swift b/Sources/ModelsSTU3/Flag.swift new file mode 100644 index 0000000..465f563 --- /dev/null +++ b/Sources/ModelsSTU3/Flag.swift @@ -0,0 +1,173 @@ +// +// Flag.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Flag) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Key information to flag to healthcare providers. + + Prospective warnings of potential issues when providing care to the patient. + */ +open class Flag: DomainResource { + + override open class var resourceType: ResourceType { return .flag } + + /// Business identifier + public var identifier: [Identifier]? + + /// Supports basic workflow. + public var status: FHIRPrimitive + + /// Clinical, administrative, etc. + public var category: CodeableConcept? + + /// Coded or textual message to display to user + public var code: CodeableConcept + + /// Who/What is flag about? + public var subject: Reference + + /// Time period when flag is active + public var period: Period? + + /// Alert relevant during encounter + public var encounter: Reference? + + /// Flag creator + public var author: Reference? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept, status: FHIRPrimitive, subject: Reference) { + self.code = code + self.status = status + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + author: Reference? = nil, + category: CodeableConcept? = nil, + code: CodeableConcept, + contained: [ResourceProxy]? = nil, + encounter: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil, + status: FHIRPrimitive, + subject: Reference, + text: Narrative? = nil) + { + self.init(code: code, status: status, subject: subject) + self.author = author + self.category = category + self.contained = contained + self.encounter = encounter + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.period = period + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case author + case category + case code + case encounter + case identifier + case period + case status; case _status + case subject + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.author = try Reference(from: _container, forKeyIfPresent: .author) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.code = try CodeableConcept(from: _container, forKey: .code) + self.encounter = try Reference(from: _container, forKeyIfPresent: .encounter) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try author?.encode(on: &_container, forKey: .author) + try category?.encode(on: &_container, forKey: .category) + try code.encode(on: &_container, forKey: .code) + try encounter?.encode(on: &_container, forKey: .encounter) + try identifier?.encode(on: &_container, forKey: .identifier) + try period?.encode(on: &_container, forKey: .period) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Flag else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return author == _other.author + && category == _other.category + && code == _other.code + && encounter == _other.encounter + && identifier == _other.identifier + && period == _other.period + && status == _other.status + && subject == _other.subject + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(author) + hasher.combine(category) + hasher.combine(code) + hasher.combine(encounter) + hasher.combine(identifier) + hasher.combine(period) + hasher.combine(status) + hasher.combine(subject) + } +} diff --git a/Sources/ModelsSTU3/Goal.swift b/Sources/ModelsSTU3/Goal.swift new file mode 100644 index 0000000..a3e0288 --- /dev/null +++ b/Sources/ModelsSTU3/Goal.swift @@ -0,0 +1,429 @@ +// +// Goal.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Goal) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Describes the intended objective(s) for a patient, group or organization. + + Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an + activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc. + */ +open class Goal: DomainResource { + + override open class var resourceType: ResourceType { return .goal } + + /// All possible types for "start[x]" + public enum StartX: Hashable { + case codeableConcept(CodeableConcept) + case date(FHIRPrimitive) + } + + /// External Ids for this goal + public var identifier: [Identifier]? + + /// Indicates whether the goal has been reached and is still considered relevant. + public var status: FHIRPrimitive + + /// E.g. Treatment, dietary, behavioral, etc. + public var category: [CodeableConcept]? + + /// high-priority | medium-priority | low-priority + public var priority: CodeableConcept? + + /// Code or text describing goal + public var description_fhir: CodeableConcept + + /// Who this goal is intended for + public var subject: Reference? + + /// When goal pursuit begins + /// One of `start[x]` + public var start: StartX? + + /// Target outcome for the goal + public var target: GoalTarget? + + /// When goal status took effect + public var statusDate: FHIRPrimitive? + + /// Reason for current status + public var statusReason: FHIRPrimitive? + + /// Who's responsible for creating Goal? + public var expressedBy: Reference? + + /// Issues addressed by this goal + public var addresses: [Reference]? + + /// Comments about the goal + public var note: [Annotation]? + + /// What result was achieved regarding the goal? + public var outcomeCode: [CodeableConcept]? + + /// Observation that resulted from goal + public var outcomeReference: [Reference]? + + /// Designated initializer taking all required properties + public init(description_fhir: CodeableConcept, status: FHIRPrimitive) { + self.description_fhir = description_fhir + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + addresses: [Reference]? = nil, + category: [CodeableConcept]? = nil, + contained: [ResourceProxy]? = nil, + description_fhir: CodeableConcept, + expressedBy: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + outcomeCode: [CodeableConcept]? = nil, + outcomeReference: [Reference]? = nil, + priority: CodeableConcept? = nil, + start: StartX? = nil, + status: FHIRPrimitive, + statusDate: FHIRPrimitive? = nil, + statusReason: FHIRPrimitive? = nil, + subject: Reference? = nil, + target: GoalTarget? = nil, + text: Narrative? = nil) + { + self.init(description_fhir: description_fhir, status: status) + self.addresses = addresses + self.category = category + self.contained = contained + self.expressedBy = expressedBy + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.outcomeCode = outcomeCode + self.outcomeReference = outcomeReference + self.priority = priority + self.start = start + self.statusDate = statusDate + self.statusReason = statusReason + self.subject = subject + self.target = target + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case addresses + case category + case description_fhir = "description" + case expressedBy + case identifier + case note + case outcomeCode + case outcomeReference + case priority + case startCodeableConcept + case startDate; case _startDate + case status; case _status + case statusDate; case _statusDate + case statusReason; case _statusReason + case subject + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.addresses = try [Reference](from: _container, forKeyIfPresent: .addresses) + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.description_fhir = try CodeableConcept(from: _container, forKey: .description_fhir) + self.expressedBy = try Reference(from: _container, forKeyIfPresent: .expressedBy) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.outcomeCode = try [CodeableConcept](from: _container, forKeyIfPresent: .outcomeCode) + self.outcomeReference = try [Reference](from: _container, forKeyIfPresent: .outcomeReference) + self.priority = try CodeableConcept(from: _container, forKeyIfPresent: .priority) + var _t_start: StartX? = nil + if let startDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .startDate, auxiliaryKey: ._startDate) { + if _t_start != nil { + throw DecodingError.dataCorruptedError(forKey: .startDate, in: _container, debugDescription: "More than one value provided for \"start\"") + } + _t_start = .date(startDate) + } + if let startCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .startCodeableConcept) { + if _t_start != nil { + throw DecodingError.dataCorruptedError(forKey: .startCodeableConcept, in: _container, debugDescription: "More than one value provided for \"start\"") + } + _t_start = .codeableConcept(startCodeableConcept) + } + self.start = _t_start + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.statusDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .statusDate, auxiliaryKey: ._statusDate) + self.statusReason = try FHIRPrimitive(from: _container, forKeyIfPresent: .statusReason, auxiliaryKey: ._statusReason) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.target = try GoalTarget(from: _container, forKeyIfPresent: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try addresses?.encode(on: &_container, forKey: .addresses) + try category?.encode(on: &_container, forKey: .category) + try description_fhir.encode(on: &_container, forKey: .description_fhir) + try expressedBy?.encode(on: &_container, forKey: .expressedBy) + try identifier?.encode(on: &_container, forKey: .identifier) + try note?.encode(on: &_container, forKey: .note) + try outcomeCode?.encode(on: &_container, forKey: .outcomeCode) + try outcomeReference?.encode(on: &_container, forKey: .outcomeReference) + try priority?.encode(on: &_container, forKey: .priority) + if let _enum = start { + switch _enum { + case .date(let _value): + try _value.encode(on: &_container, forKey: .startDate, auxiliaryKey: ._startDate) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .startCodeableConcept) + } + } + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try statusDate?.encode(on: &_container, forKey: .statusDate, auxiliaryKey: ._statusDate) + try statusReason?.encode(on: &_container, forKey: .statusReason, auxiliaryKey: ._statusReason) + try subject?.encode(on: &_container, forKey: .subject) + try target?.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Goal else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return addresses == _other.addresses + && category == _other.category + && description_fhir == _other.description_fhir + && expressedBy == _other.expressedBy + && identifier == _other.identifier + && note == _other.note + && outcomeCode == _other.outcomeCode + && outcomeReference == _other.outcomeReference + && priority == _other.priority + && start == _other.start + && status == _other.status + && statusDate == _other.statusDate + && statusReason == _other.statusReason + && subject == _other.subject + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(addresses) + hasher.combine(category) + hasher.combine(description_fhir) + hasher.combine(expressedBy) + hasher.combine(identifier) + hasher.combine(note) + hasher.combine(outcomeCode) + hasher.combine(outcomeReference) + hasher.combine(priority) + hasher.combine(start) + hasher.combine(status) + hasher.combine(statusDate) + hasher.combine(statusReason) + hasher.combine(subject) + hasher.combine(target) + } +} + +/** + Target outcome for the goal. + + Indicates what should be done by when. + */ +open class GoalTarget: BackboneElement { + + /// All possible types for "detail[x]" + public enum DetailX: Hashable { + case codeableConcept(CodeableConcept) + case quantity(Quantity) + case range(Range) + } + + /// All possible types for "due[x]" + public enum DueX: Hashable { + case date(FHIRPrimitive) + case duration(Duration) + } + + /// The parameter whose value is being tracked + public var measure: CodeableConcept? + + /// The target value to be achieved + /// One of `detail[x]` + public var detail: DetailX? + + /// Reach goal on or before + /// One of `due[x]` + public var due: DueX? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + detail: DetailX? = nil, + due: DueX? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + measure: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.detail = detail + self.due = due + self.`extension` = `extension` + self.id = id + self.measure = measure + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case detailCodeableConcept + case detailQuantity + case detailRange + case dueDate; case _dueDate + case dueDuration + case measure + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_detail: DetailX? = nil + if let detailQuantity = try Quantity(from: _container, forKeyIfPresent: .detailQuantity) { + if _t_detail != nil { + throw DecodingError.dataCorruptedError(forKey: .detailQuantity, in: _container, debugDescription: "More than one value provided for \"detail\"") + } + _t_detail = .quantity(detailQuantity) + } + if let detailRange = try Range(from: _container, forKeyIfPresent: .detailRange) { + if _t_detail != nil { + throw DecodingError.dataCorruptedError(forKey: .detailRange, in: _container, debugDescription: "More than one value provided for \"detail\"") + } + _t_detail = .range(detailRange) + } + if let detailCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .detailCodeableConcept) { + if _t_detail != nil { + throw DecodingError.dataCorruptedError(forKey: .detailCodeableConcept, in: _container, debugDescription: "More than one value provided for \"detail\"") + } + _t_detail = .codeableConcept(detailCodeableConcept) + } + self.detail = _t_detail + var _t_due: DueX? = nil + if let dueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .dueDate, auxiliaryKey: ._dueDate) { + if _t_due != nil { + throw DecodingError.dataCorruptedError(forKey: .dueDate, in: _container, debugDescription: "More than one value provided for \"due\"") + } + _t_due = .date(dueDate) + } + if let dueDuration = try Duration(from: _container, forKeyIfPresent: .dueDuration) { + if _t_due != nil { + throw DecodingError.dataCorruptedError(forKey: .dueDuration, in: _container, debugDescription: "More than one value provided for \"due\"") + } + _t_due = .duration(dueDuration) + } + self.due = _t_due + self.measure = try CodeableConcept(from: _container, forKeyIfPresent: .measure) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = detail { + switch _enum { + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .detailQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .detailRange) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .detailCodeableConcept) + } + } + if let _enum = due { + switch _enum { + case .date(let _value): + try _value.encode(on: &_container, forKey: .dueDate, auxiliaryKey: ._dueDate) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .dueDuration) + } + } + try measure?.encode(on: &_container, forKey: .measure) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? GoalTarget else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return detail == _other.detail + && due == _other.due + && measure == _other.measure + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(detail) + hasher.combine(due) + hasher.combine(measure) + } +} diff --git a/Sources/ModelsSTU3/GraphDefinition.swift b/Sources/ModelsSTU3/GraphDefinition.swift new file mode 100644 index 0000000..d5617b8 --- /dev/null +++ b/Sources/ModelsSTU3/GraphDefinition.swift @@ -0,0 +1,561 @@ +// +// GraphDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/GraphDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Definition of an graph of resources. + + A formal computable definition of a graph of resources - that is, a coherent set of resources that form a graph by + following references. The Graph Definition resource defines a set and makes rules about the set. + */ +open class GraphDefinition: DomainResource { + + override open class var resourceType: ResourceType { return .graphDefinition } + + /// Logical URI to reference this graph definition (globally unique) + public var url: FHIRPrimitive? + + /// Business version of the graph definition + public var version: FHIRPrimitive? + + /// Name for this graph definition (computer friendly) + public var name: FHIRPrimitive + + /// The status of this graph definition. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the graph definition + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for graph definition (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Why this graph definition is defined + public var purpose: FHIRPrimitive? + + /// The type of FHIR resource at which instances of this graph start. + public var start: FHIRPrimitive + + /// Profile on base resource + public var profile: FHIRPrimitive? + + /// Links this graph makes rules about + public var link: [GraphDefinitionLink]? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive, start: FHIRPrimitive, status: FHIRPrimitive) { + self.name = name + self.start = start + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + link: [GraphDefinitionLink]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + profile: FHIRPrimitive? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + start: FHIRPrimitive, + status: FHIRPrimitive, + text: Narrative? = nil, + url: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(name: name, start: start, status: status) + self.contact = contact + self.contained = contained + self.date = date + self.description_fhir = description_fhir + self.experimental = experimental + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.link = link + self.meta = meta + self.modifierExtension = modifierExtension + self.profile = profile + self.publisher = publisher + self.purpose = purpose + self.text = text + self.url = url + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contact + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case experimental; case _experimental + case jurisdiction + case link + case name; case _name + case profile; case _profile + case publisher; case _publisher + case purpose; case _purpose + case start; case _start + case status; case _status + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.link = try [GraphDefinitionLink](from: _container, forKeyIfPresent: .link) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.profile = try FHIRPrimitive(from: _container, forKeyIfPresent: .profile, auxiliaryKey: ._profile) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.start = try FHIRPrimitive(from: _container, forKey: .start, auxiliaryKey: ._start) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contact?.encode(on: &_container, forKey: .contact) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try link?.encode(on: &_container, forKey: .link) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try profile?.encode(on: &_container, forKey: .profile, auxiliaryKey: ._profile) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try start.encode(on: &_container, forKey: .start, auxiliaryKey: ._start) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? GraphDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contact == _other.contact + && date == _other.date + && description_fhir == _other.description_fhir + && experimental == _other.experimental + && jurisdiction == _other.jurisdiction + && link == _other.link + && name == _other.name + && profile == _other.profile + && publisher == _other.publisher + && purpose == _other.purpose + && start == _other.start + && status == _other.status + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contact) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(experimental) + hasher.combine(jurisdiction) + hasher.combine(link) + hasher.combine(name) + hasher.combine(profile) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(start) + hasher.combine(status) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Links this graph makes rules about. + */ +open class GraphDefinitionLink: BackboneElement { + + /// Path in the resource that contains the link + public var path: FHIRPrimitive + + /// Which slice (if profiled) + public var sliceName: FHIRPrimitive? + + /// Minimum occurrences for this link + public var min: FHIRPrimitive? + + /// Maximum occurrences for this link + public var max: FHIRPrimitive? + + /// Why this link is specified + public var description_fhir: FHIRPrimitive? + + /// Potential target for the link + public var target: [GraphDefinitionLinkTarget] + + /// Designated initializer taking all required properties + public init(path: FHIRPrimitive, target: [GraphDefinitionLinkTarget]) { + self.path = path + self.target = target + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + max: FHIRPrimitive? = nil, + min: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + path: FHIRPrimitive, + sliceName: FHIRPrimitive? = nil, + target: [GraphDefinitionLinkTarget]) + { + self.init(path: path, target: target) + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.max = max + self.min = min + self.modifierExtension = modifierExtension + self.sliceName = sliceName + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case max; case _max + case min; case _min + case path; case _path + case sliceName; case _sliceName + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.max = try FHIRPrimitive(from: _container, forKeyIfPresent: .max, auxiliaryKey: ._max) + self.min = try FHIRPrimitive(from: _container, forKeyIfPresent: .min, auxiliaryKey: ._min) + self.path = try FHIRPrimitive(from: _container, forKey: .path, auxiliaryKey: ._path) + self.sliceName = try FHIRPrimitive(from: _container, forKeyIfPresent: .sliceName, auxiliaryKey: ._sliceName) + self.target = try [GraphDefinitionLinkTarget](from: _container, forKey: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try max?.encode(on: &_container, forKey: .max, auxiliaryKey: ._max) + try min?.encode(on: &_container, forKey: .min, auxiliaryKey: ._min) + try path.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + try sliceName?.encode(on: &_container, forKey: .sliceName, auxiliaryKey: ._sliceName) + try target.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? GraphDefinitionLink else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && max == _other.max + && min == _other.min + && path == _other.path + && sliceName == _other.sliceName + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(max) + hasher.combine(min) + hasher.combine(path) + hasher.combine(sliceName) + hasher.combine(target) + } +} + +/** + Potential target for the link. + */ +open class GraphDefinitionLinkTarget: BackboneElement { + + /// None + public var type: FHIRPrimitive + + /// Profile for the target resource + public var profile: FHIRPrimitive? + + /// Compartment Consistency Rules + public var compartment: [GraphDefinitionLinkTargetCompartment]? + + /// Additional links from target resource + public var link: [GraphDefinitionLink]? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + compartment: [GraphDefinitionLinkTargetCompartment]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + link: [GraphDefinitionLink]? = nil, + modifierExtension: [Extension]? = nil, + profile: FHIRPrimitive? = nil, + type: FHIRPrimitive) + { + self.init(type: type) + self.compartment = compartment + self.`extension` = `extension` + self.id = id + self.link = link + self.modifierExtension = modifierExtension + self.profile = profile + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case compartment + case link + case profile; case _profile + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.compartment = try [GraphDefinitionLinkTargetCompartment](from: _container, forKeyIfPresent: .compartment) + self.link = try [GraphDefinitionLink](from: _container, forKeyIfPresent: .link) + self.profile = try FHIRPrimitive(from: _container, forKeyIfPresent: .profile, auxiliaryKey: ._profile) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try compartment?.encode(on: &_container, forKey: .compartment) + try link?.encode(on: &_container, forKey: .link) + try profile?.encode(on: &_container, forKey: .profile, auxiliaryKey: ._profile) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? GraphDefinitionLinkTarget else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return compartment == _other.compartment + && link == _other.link + && profile == _other.profile + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(compartment) + hasher.combine(link) + hasher.combine(profile) + hasher.combine(type) + } +} + +/** + Compartment Consistency Rules. + */ +open class GraphDefinitionLinkTargetCompartment: BackboneElement { + + /// None + public var code: FHIRPrimitive + + /// identical | matching | different | no-rule | custom. + public var rule: FHIRPrimitive + + /// Custom rule, as a FHIRPath expression + public var expression: FHIRPrimitive? + + /// Documentation for FHIRPath expression + public var description_fhir: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, rule: FHIRPrimitive) { + self.code = code + self.rule = rule + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + description_fhir: FHIRPrimitive? = nil, + expression: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + rule: FHIRPrimitive) + { + self.init(code: code, rule: rule) + self.description_fhir = description_fhir + self.expression = expression + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case description_fhir = "description"; case _description_fhir = "_description" + case expression; case _expression + case rule; case _rule + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.expression = try FHIRPrimitive(from: _container, forKeyIfPresent: .expression, auxiliaryKey: ._expression) + self.rule = try FHIRPrimitive(from: _container, forKey: .rule, auxiliaryKey: ._rule) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try expression?.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try rule.encode(on: &_container, forKey: .rule, auxiliaryKey: ._rule) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? GraphDefinitionLinkTargetCompartment else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && description_fhir == _other.description_fhir + && expression == _other.expression + && rule == _other.rule + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(description_fhir) + hasher.combine(expression) + hasher.combine(rule) + } +} diff --git a/Sources/ModelsSTU3/Group.swift b/Sources/ModelsSTU3/Group.swift new file mode 100644 index 0000000..fd49d36 --- /dev/null +++ b/Sources/ModelsSTU3/Group.swift @@ -0,0 +1,430 @@ +// +// Group.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Group) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Group of multiple entities. + + Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected + to act collectively and are not formally or legally recognized; i.e. a collection of entities that isn't an + Organization. + */ +open class Group: DomainResource { + + override open class var resourceType: ResourceType { return .group } + + /// Unique id + public var identifier: [Identifier]? + + /// Whether this group's record is in active use + public var active: FHIRPrimitive? + + /// Identifies the broad classification of the kind of resources the group includes. + public var type: FHIRPrimitive + + /// Descriptive or actual + public var actual: FHIRPrimitive + + /// Kind of Group members + public var code: CodeableConcept? + + /// Label for Group + public var name: FHIRPrimitive? + + /// Number of members + public var quantity: FHIRPrimitive? + + /// Trait of group members + public var characteristic: [GroupCharacteristic]? + + /// Who or what is in group + public var member: [GroupMember]? + + /// Designated initializer taking all required properties + public init(actual: FHIRPrimitive, type: FHIRPrimitive) { + self.actual = actual + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + actual: FHIRPrimitive, + characteristic: [GroupCharacteristic]? = nil, + code: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + member: [GroupMember]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + quantity: FHIRPrimitive? = nil, + text: Narrative? = nil, + type: FHIRPrimitive) + { + self.init(actual: actual, type: type) + self.active = active + self.characteristic = characteristic + self.code = code + self.contained = contained + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.member = member + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.quantity = quantity + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case actual; case _actual + case characteristic + case code + case identifier + case member + case name; case _name + case quantity; case _quantity + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.actual = try FHIRPrimitive(from: _container, forKey: .actual, auxiliaryKey: ._actual) + self.characteristic = try [GroupCharacteristic](from: _container, forKeyIfPresent: .characteristic) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.member = try [GroupMember](from: _container, forKeyIfPresent: .member) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.quantity = try FHIRPrimitive(from: _container, forKeyIfPresent: .quantity, auxiliaryKey: ._quantity) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try actual.encode(on: &_container, forKey: .actual, auxiliaryKey: ._actual) + try characteristic?.encode(on: &_container, forKey: .characteristic) + try code?.encode(on: &_container, forKey: .code) + try identifier?.encode(on: &_container, forKey: .identifier) + try member?.encode(on: &_container, forKey: .member) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try quantity?.encode(on: &_container, forKey: .quantity, auxiliaryKey: ._quantity) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Group else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && actual == _other.actual + && characteristic == _other.characteristic + && code == _other.code + && identifier == _other.identifier + && member == _other.member + && name == _other.name + && quantity == _other.quantity + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(actual) + hasher.combine(characteristic) + hasher.combine(code) + hasher.combine(identifier) + hasher.combine(member) + hasher.combine(name) + hasher.combine(quantity) + hasher.combine(type) + } +} + +/** + Trait of group members. + + Identifies the traits shared by members of the group. + */ +open class GroupCharacteristic: BackboneElement { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case boolean(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case quantity(Quantity) + case range(Range) + } + + /// Kind of characteristic + public var code: CodeableConcept + + /// Value held by characteristic + /// One of `value[x]` + public var value: ValueX + + /// Group includes or excludes + public var exclude: FHIRPrimitive + + /// Period over which characteristic is tested + public var period: Period? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept, exclude: FHIRPrimitive, value: ValueX) { + self.code = code + self.exclude = exclude + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept, + exclude: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil, + value: ValueX) + { + self.init(code: code, exclude: exclude, value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.period = period + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case exclude; case _exclude + case period + case valueBoolean; case _valueBoolean + case valueCodeableConcept + case valueQuantity + case valueRange + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.valueBoolean) || _container.contains(CodingKeys.valueCodeableConcept) || _container.contains(CodingKeys.valueQuantity) || _container.contains(CodingKeys.valueRange) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.valueBoolean, CodingKeys.valueCodeableConcept, CodingKeys.valueQuantity, CodingKeys.valueRange], debugDescription: "Must have at least one value for \"value\" but have none")) + } + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKey: .code) + self.exclude = try FHIRPrimitive(from: _container, forKey: .exclude, auxiliaryKey: ._exclude) + self.period = try Period(from: _container, forKeyIfPresent: .period) + var _t_value: ValueX? = nil + if let valueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .valueCodeableConcept) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .codeableConcept(valueCodeableConcept) + } + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueRange = try Range(from: _container, forKeyIfPresent: .valueRange) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRange, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .range(valueRange) + } + self.value = _t_value! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code) + try exclude.encode(on: &_container, forKey: .exclude, auxiliaryKey: ._exclude) + try period?.encode(on: &_container, forKey: .period) + + switch value { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .valueCodeableConcept) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .valueRange) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? GroupCharacteristic else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && exclude == _other.exclude + && period == _other.period + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(exclude) + hasher.combine(period) + hasher.combine(value) + } +} + +/** + Who or what is in group. + + Identifies the resource instances that are members of the group. + */ +open class GroupMember: BackboneElement { + + /// Reference to the group member + public var entity: Reference + + /// Period member belonged to the group + public var period: Period? + + /// If member is no longer in group + public var inactive: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(entity: Reference) { + self.entity = entity + super.init() + } + + /// Convenience initializer + public convenience init( + entity: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + inactive: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil) + { + self.init(entity: entity) + self.`extension` = `extension` + self.id = id + self.inactive = inactive + self.modifierExtension = modifierExtension + self.period = period + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case entity + case inactive; case _inactive + case period + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.entity = try Reference(from: _container, forKey: .entity) + self.inactive = try FHIRPrimitive(from: _container, forKeyIfPresent: .inactive, auxiliaryKey: ._inactive) + self.period = try Period(from: _container, forKeyIfPresent: .period) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try entity.encode(on: &_container, forKey: .entity) + try inactive?.encode(on: &_container, forKey: .inactive, auxiliaryKey: ._inactive) + try period?.encode(on: &_container, forKey: .period) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? GroupMember else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return entity == _other.entity + && inactive == _other.inactive + && period == _other.period + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(entity) + hasher.combine(inactive) + hasher.combine(period) + } +} diff --git a/Sources/ModelsSTU3/GuidanceResponse.swift b/Sources/ModelsSTU3/GuidanceResponse.swift new file mode 100644 index 0000000..aee02ae --- /dev/null +++ b/Sources/ModelsSTU3/GuidanceResponse.swift @@ -0,0 +1,267 @@ +// +// GuidanceResponse.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/GuidanceResponse) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The formal response to a guidance request. + + A guidance response is the formal response to a guidance request, including any output parameters returned by the + evaluation, as well as the description of any proposed actions to be taken. + */ +open class GuidanceResponse: DomainResource { + + override open class var resourceType: ResourceType { return .guidanceResponse } + + /// All possible types for "reason[x]" + public enum ReasonX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// The id of the request associated with this response, if any + public var requestId: FHIRPrimitive? + + /// Business identifier + public var identifier: Identifier? + + /// A reference to a knowledge module + public var module: Reference + + /// The status of the response. If the evaluation is completed successfully, the status will indicate success. + /// However, in order to complete the evaluation, the engine may require more information. In this case, the status + /// will be data-required, and the response will contain a description of the additional required information. If + /// the evaluation completed successfully, but the engine determines that a potentially more accurate response could + /// be provided if more data was available, the status will be data-requested, and the response will contain a + /// description of the additional requested information. + public var status: FHIRPrimitive + + /// Patient the request was performed for + public var subject: Reference? + + /// Encounter or Episode during which the response was returned + public var context: Reference? + + /// When the guidance response was processed + public var occurrenceDateTime: FHIRPrimitive? + + /// Device returning the guidance + public var performer: Reference? + + /// Reason for the response + /// One of `reason[x]` + public var reason: ReasonX? + + /// Additional notes about the response + public var note: [Annotation]? + + /// Messages resulting from the evaluation of the artifact or artifacts + public var evaluationMessage: [Reference]? + + /// The output parameters of the evaluation, if any + public var outputParameters: Reference? + + /// Proposed actions, if any + public var result: Reference? + + /// Additional required data + public var dataRequirement: [DataRequirement]? + + /// Designated initializer taking all required properties + public init(module: Reference, status: FHIRPrimitive) { + self.module = module + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + dataRequirement: [DataRequirement]? = nil, + evaluationMessage: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + module: Reference, + note: [Annotation]? = nil, + occurrenceDateTime: FHIRPrimitive? = nil, + outputParameters: Reference? = nil, + performer: Reference? = nil, + reason: ReasonX? = nil, + requestId: FHIRPrimitive? = nil, + result: Reference? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil) + { + self.init(module: module, status: status) + self.contained = contained + self.context = context + self.dataRequirement = dataRequirement + self.evaluationMessage = evaluationMessage + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.occurrenceDateTime = occurrenceDateTime + self.outputParameters = outputParameters + self.performer = performer + self.reason = reason + self.requestId = requestId + self.result = result + self.subject = subject + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case context + case dataRequirement + case evaluationMessage + case identifier + case module + case note + case occurrenceDateTime; case _occurrenceDateTime + case outputParameters + case performer + case reasonCodeableConcept + case reasonReference + case requestId; case _requestId + case result + case status; case _status + case subject + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.dataRequirement = try [DataRequirement](from: _container, forKeyIfPresent: .dataRequirement) + self.evaluationMessage = try [Reference](from: _container, forKeyIfPresent: .evaluationMessage) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.module = try Reference(from: _container, forKey: .module) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.occurrenceDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + self.outputParameters = try Reference(from: _container, forKeyIfPresent: .outputParameters) + self.performer = try Reference(from: _container, forKeyIfPresent: .performer) + var _t_reason: ReasonX? = nil + if let reasonCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .reasonCodeableConcept) { + if _t_reason != nil { + throw DecodingError.dataCorruptedError(forKey: .reasonCodeableConcept, in: _container, debugDescription: "More than one value provided for \"reason\"") + } + _t_reason = .codeableConcept(reasonCodeableConcept) + } + if let reasonReference = try Reference(from: _container, forKeyIfPresent: .reasonReference) { + if _t_reason != nil { + throw DecodingError.dataCorruptedError(forKey: .reasonReference, in: _container, debugDescription: "More than one value provided for \"reason\"") + } + _t_reason = .reference(reasonReference) + } + self.reason = _t_reason + self.requestId = try FHIRPrimitive(from: _container, forKeyIfPresent: .requestId, auxiliaryKey: ._requestId) + self.result = try Reference(from: _container, forKeyIfPresent: .result) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try context?.encode(on: &_container, forKey: .context) + try dataRequirement?.encode(on: &_container, forKey: .dataRequirement) + try evaluationMessage?.encode(on: &_container, forKey: .evaluationMessage) + try identifier?.encode(on: &_container, forKey: .identifier) + try module.encode(on: &_container, forKey: .module) + try note?.encode(on: &_container, forKey: .note) + try occurrenceDateTime?.encode(on: &_container, forKey: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + try outputParameters?.encode(on: &_container, forKey: .outputParameters) + try performer?.encode(on: &_container, forKey: .performer) + if let _enum = reason { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .reasonCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .reasonReference) + } + } + try requestId?.encode(on: &_container, forKey: .requestId, auxiliaryKey: ._requestId) + try result?.encode(on: &_container, forKey: .result) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? GuidanceResponse else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return context == _other.context + && dataRequirement == _other.dataRequirement + && evaluationMessage == _other.evaluationMessage + && identifier == _other.identifier + && module == _other.module + && note == _other.note + && occurrenceDateTime == _other.occurrenceDateTime + && outputParameters == _other.outputParameters + && performer == _other.performer + && reason == _other.reason + && requestId == _other.requestId + && result == _other.result + && status == _other.status + && subject == _other.subject + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(context) + hasher.combine(dataRequirement) + hasher.combine(evaluationMessage) + hasher.combine(identifier) + hasher.combine(module) + hasher.combine(note) + hasher.combine(occurrenceDateTime) + hasher.combine(outputParameters) + hasher.combine(performer) + hasher.combine(reason) + hasher.combine(requestId) + hasher.combine(result) + hasher.combine(status) + hasher.combine(subject) + } +} diff --git a/Sources/ModelsSTU3/HealthcareService.swift b/Sources/ModelsSTU3/HealthcareService.swift new file mode 100644 index 0000000..ac2b174 --- /dev/null +++ b/Sources/ModelsSTU3/HealthcareService.swift @@ -0,0 +1,513 @@ +// +// HealthcareService.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/HealthcareService) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The details of a healthcare service available at a location. + */ +open class HealthcareService: DomainResource { + + override open class var resourceType: ResourceType { return .healthcareService } + + /// External identifiers for this item + public var identifier: [Identifier]? + + /// Whether this healthcareservice is in active use + public var active: FHIRPrimitive? + + /// Organization that provides this service + public var providedBy: Reference? + + /// Broad category of service being performed or delivered + public var category: CodeableConcept? + + /// Type of service that may be delivered or performed + public var type: [CodeableConcept]? + + /// Specialties handled by the HealthcareService + public var specialty: [CodeableConcept]? + + /// Location(s) where service may be provided + public var location: [Reference]? + + /// Description of service as presented to a consumer while searching + public var name: FHIRPrimitive? + + /// Additional description and/or any specific issues not covered elsewhere + public var comment: FHIRPrimitive? + + /// Extra details about the service that can't be placed in the other fields + public var extraDetails: FHIRPrimitive? + + /// Facilitates quick identification of the service + public var photo: Attachment? + + /// Contacts related to the healthcare service + public var telecom: [ContactPoint]? + + /// Location(s) service is inteded for/available to + public var coverageArea: [Reference]? + + /// Conditions under which service is available/offered + public var serviceProvisionCode: [CodeableConcept]? + + /// Specific eligibility requirements required to use the service + public var eligibility: CodeableConcept? + + /// Describes the eligibility conditions for the service + public var eligibilityNote: FHIRPrimitive? + + /// Program Names that categorize the service + public var programName: [FHIRPrimitive]? + + /// Collection of characteristics (attributes) + public var characteristic: [CodeableConcept]? + + /// Ways that the service accepts referrals + public var referralMethod: [CodeableConcept]? + + /// If an appointment is required for access to this service + public var appointmentRequired: FHIRPrimitive? + + /// Times the Service Site is available + public var availableTime: [HealthcareServiceAvailableTime]? + + /// Not available during this time due to provided reason + public var notAvailable: [HealthcareServiceNotAvailable]? + + /// Description of availability exceptions + public var availabilityExceptions: FHIRPrimitive? + + /// Technical endpoints providing access to services operated for the location + public var endpoint: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + appointmentRequired: FHIRPrimitive? = nil, + availabilityExceptions: FHIRPrimitive? = nil, + availableTime: [HealthcareServiceAvailableTime]? = nil, + category: CodeableConcept? = nil, + characteristic: [CodeableConcept]? = nil, + comment: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + coverageArea: [Reference]? = nil, + eligibility: CodeableConcept? = nil, + eligibilityNote: FHIRPrimitive? = nil, + endpoint: [Reference]? = nil, + `extension`: [Extension]? = nil, + extraDetails: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + location: [Reference]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + notAvailable: [HealthcareServiceNotAvailable]? = nil, + photo: Attachment? = nil, + programName: [FHIRPrimitive]? = nil, + providedBy: Reference? = nil, + referralMethod: [CodeableConcept]? = nil, + serviceProvisionCode: [CodeableConcept]? = nil, + specialty: [CodeableConcept]? = nil, + telecom: [ContactPoint]? = nil, + text: Narrative? = nil, + type: [CodeableConcept]? = nil) + { + self.init() + self.active = active + self.appointmentRequired = appointmentRequired + self.availabilityExceptions = availabilityExceptions + self.availableTime = availableTime + self.category = category + self.characteristic = characteristic + self.comment = comment + self.contained = contained + self.coverageArea = coverageArea + self.eligibility = eligibility + self.eligibilityNote = eligibilityNote + self.endpoint = endpoint + self.`extension` = `extension` + self.extraDetails = extraDetails + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.location = location + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.notAvailable = notAvailable + self.photo = photo + self.programName = programName + self.providedBy = providedBy + self.referralMethod = referralMethod + self.serviceProvisionCode = serviceProvisionCode + self.specialty = specialty + self.telecom = telecom + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case appointmentRequired; case _appointmentRequired + case availabilityExceptions; case _availabilityExceptions + case availableTime + case category + case characteristic + case comment; case _comment + case coverageArea + case eligibility + case eligibilityNote; case _eligibilityNote + case endpoint + case extraDetails; case _extraDetails + case identifier + case location + case name; case _name + case notAvailable + case photo + case programName; case _programName + case providedBy + case referralMethod + case serviceProvisionCode + case specialty + case telecom + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.appointmentRequired = try FHIRPrimitive(from: _container, forKeyIfPresent: .appointmentRequired, auxiliaryKey: ._appointmentRequired) + self.availabilityExceptions = try FHIRPrimitive(from: _container, forKeyIfPresent: .availabilityExceptions, auxiliaryKey: ._availabilityExceptions) + self.availableTime = try [HealthcareServiceAvailableTime](from: _container, forKeyIfPresent: .availableTime) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.characteristic = try [CodeableConcept](from: _container, forKeyIfPresent: .characteristic) + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.coverageArea = try [Reference](from: _container, forKeyIfPresent: .coverageArea) + self.eligibility = try CodeableConcept(from: _container, forKeyIfPresent: .eligibility) + self.eligibilityNote = try FHIRPrimitive(from: _container, forKeyIfPresent: .eligibilityNote, auxiliaryKey: ._eligibilityNote) + self.endpoint = try [Reference](from: _container, forKeyIfPresent: .endpoint) + self.extraDetails = try FHIRPrimitive(from: _container, forKeyIfPresent: .extraDetails, auxiliaryKey: ._extraDetails) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.location = try [Reference](from: _container, forKeyIfPresent: .location) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.notAvailable = try [HealthcareServiceNotAvailable](from: _container, forKeyIfPresent: .notAvailable) + self.photo = try Attachment(from: _container, forKeyIfPresent: .photo) + self.programName = try [FHIRPrimitive](from: _container, forKeyIfPresent: .programName, auxiliaryKey: ._programName) + self.providedBy = try Reference(from: _container, forKeyIfPresent: .providedBy) + self.referralMethod = try [CodeableConcept](from: _container, forKeyIfPresent: .referralMethod) + self.serviceProvisionCode = try [CodeableConcept](from: _container, forKeyIfPresent: .serviceProvisionCode) + self.specialty = try [CodeableConcept](from: _container, forKeyIfPresent: .specialty) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + self.type = try [CodeableConcept](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try appointmentRequired?.encode(on: &_container, forKey: .appointmentRequired, auxiliaryKey: ._appointmentRequired) + try availabilityExceptions?.encode(on: &_container, forKey: .availabilityExceptions, auxiliaryKey: ._availabilityExceptions) + try availableTime?.encode(on: &_container, forKey: .availableTime) + try category?.encode(on: &_container, forKey: .category) + try characteristic?.encode(on: &_container, forKey: .characteristic) + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try coverageArea?.encode(on: &_container, forKey: .coverageArea) + try eligibility?.encode(on: &_container, forKey: .eligibility) + try eligibilityNote?.encode(on: &_container, forKey: .eligibilityNote, auxiliaryKey: ._eligibilityNote) + try endpoint?.encode(on: &_container, forKey: .endpoint) + try extraDetails?.encode(on: &_container, forKey: .extraDetails, auxiliaryKey: ._extraDetails) + try identifier?.encode(on: &_container, forKey: .identifier) + try location?.encode(on: &_container, forKey: .location) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try notAvailable?.encode(on: &_container, forKey: .notAvailable) + try photo?.encode(on: &_container, forKey: .photo) + try programName?.encode(on: &_container, forKey: .programName, auxiliaryKey: ._programName) + try providedBy?.encode(on: &_container, forKey: .providedBy) + try referralMethod?.encode(on: &_container, forKey: .referralMethod) + try serviceProvisionCode?.encode(on: &_container, forKey: .serviceProvisionCode) + try specialty?.encode(on: &_container, forKey: .specialty) + try telecom?.encode(on: &_container, forKey: .telecom) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? HealthcareService else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && appointmentRequired == _other.appointmentRequired + && availabilityExceptions == _other.availabilityExceptions + && availableTime == _other.availableTime + && category == _other.category + && characteristic == _other.characteristic + && comment == _other.comment + && coverageArea == _other.coverageArea + && eligibility == _other.eligibility + && eligibilityNote == _other.eligibilityNote + && endpoint == _other.endpoint + && extraDetails == _other.extraDetails + && identifier == _other.identifier + && location == _other.location + && name == _other.name + && notAvailable == _other.notAvailable + && photo == _other.photo + && programName == _other.programName + && providedBy == _other.providedBy + && referralMethod == _other.referralMethod + && serviceProvisionCode == _other.serviceProvisionCode + && specialty == _other.specialty + && telecom == _other.telecom + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(appointmentRequired) + hasher.combine(availabilityExceptions) + hasher.combine(availableTime) + hasher.combine(category) + hasher.combine(characteristic) + hasher.combine(comment) + hasher.combine(coverageArea) + hasher.combine(eligibility) + hasher.combine(eligibilityNote) + hasher.combine(endpoint) + hasher.combine(extraDetails) + hasher.combine(identifier) + hasher.combine(location) + hasher.combine(name) + hasher.combine(notAvailable) + hasher.combine(photo) + hasher.combine(programName) + hasher.combine(providedBy) + hasher.combine(referralMethod) + hasher.combine(serviceProvisionCode) + hasher.combine(specialty) + hasher.combine(telecom) + hasher.combine(type) + } +} + +/** + Times the Service Site is available. + + A collection of times that the Service Site is available. + */ +open class HealthcareServiceAvailableTime: BackboneElement { + + /// Indicates which days of the week are available between the start and end Times. + public var daysOfWeek: [FHIRPrimitive]? + + /// Always available? e.g. 24 hour service + public var allDay: FHIRPrimitive? + + /// Opening time of day (ignored if allDay = true) + public var availableStartTime: FHIRPrimitive? + + /// Closing time of day (ignored if allDay = true) + public var availableEndTime: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + allDay: FHIRPrimitive? = nil, + availableEndTime: FHIRPrimitive? = nil, + availableStartTime: FHIRPrimitive? = nil, + daysOfWeek: [FHIRPrimitive]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.allDay = allDay + self.availableEndTime = availableEndTime + self.availableStartTime = availableStartTime + self.daysOfWeek = daysOfWeek + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case allDay; case _allDay + case availableEndTime; case _availableEndTime + case availableStartTime; case _availableStartTime + case daysOfWeek; case _daysOfWeek + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.allDay = try FHIRPrimitive(from: _container, forKeyIfPresent: .allDay, auxiliaryKey: ._allDay) + self.availableEndTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .availableEndTime, auxiliaryKey: ._availableEndTime) + self.availableStartTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .availableStartTime, auxiliaryKey: ._availableStartTime) + self.daysOfWeek = try [FHIRPrimitive](from: _container, forKeyIfPresent: .daysOfWeek, auxiliaryKey: ._daysOfWeek) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try allDay?.encode(on: &_container, forKey: .allDay, auxiliaryKey: ._allDay) + try availableEndTime?.encode(on: &_container, forKey: .availableEndTime, auxiliaryKey: ._availableEndTime) + try availableStartTime?.encode(on: &_container, forKey: .availableStartTime, auxiliaryKey: ._availableStartTime) + try daysOfWeek?.encode(on: &_container, forKey: .daysOfWeek, auxiliaryKey: ._daysOfWeek) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? HealthcareServiceAvailableTime else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return allDay == _other.allDay + && availableEndTime == _other.availableEndTime + && availableStartTime == _other.availableStartTime + && daysOfWeek == _other.daysOfWeek + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(allDay) + hasher.combine(availableEndTime) + hasher.combine(availableStartTime) + hasher.combine(daysOfWeek) + } +} + +/** + Not available during this time due to provided reason. + + The HealthcareService is not available during this period of time due to the provided reason. + */ +open class HealthcareServiceNotAvailable: BackboneElement { + + /// Reason presented to the user explaining why time not available + public var description_fhir: FHIRPrimitive + + /// Service not availablefrom this date + public var during: Period? + + /// Designated initializer taking all required properties + public init(description_fhir: FHIRPrimitive) { + self.description_fhir = description_fhir + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive, + during: Period? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(description_fhir: description_fhir) + self.during = during + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case during + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + self.during = try Period(from: _container, forKeyIfPresent: .during) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try during?.encode(on: &_container, forKey: .during) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? HealthcareServiceNotAvailable else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && during == _other.during + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(during) + } +} diff --git a/Sources/ModelsSTU3/HumanName.swift b/Sources/ModelsSTU3/HumanName.swift new file mode 100644 index 0000000..7ed8538 --- /dev/null +++ b/Sources/ModelsSTU3/HumanName.swift @@ -0,0 +1,149 @@ +// +// HumanName.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/HumanName) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Name of a human - parts and usage. + + A human's name with the ability to identify parts and usage. + */ +open class HumanName: Element { + + /// Identifies the purpose for this name. + public var use: FHIRPrimitive? + + /// Text representation of the full name + public var text: FHIRPrimitive? + + /// Family name (often called 'Surname') + public var family: FHIRPrimitive? + + /// Given names (not always 'first'). Includes middle names + public var given: [FHIRPrimitive]? + + /// Parts that come before the name + public var prefix: [FHIRPrimitive]? + + /// Parts that come after the name + public var suffix: [FHIRPrimitive]? + + /// Time period when name was/is in use + public var period: Period? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + family: FHIRPrimitive? = nil, + given: [FHIRPrimitive]? = nil, + id: FHIRPrimitive? = nil, + period: Period? = nil, + prefix: [FHIRPrimitive]? = nil, + suffix: [FHIRPrimitive]? = nil, + text: FHIRPrimitive? = nil, + use: FHIRPrimitive? = nil) + { + self.init() + self.`extension` = `extension` + self.family = family + self.given = given + self.id = id + self.period = period + self.prefix = prefix + self.suffix = suffix + self.text = text + self.use = use + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case family; case _family + case given; case _given + case period + case prefix; case _prefix + case suffix; case _suffix + case text; case _text + case use; case _use + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.family = try FHIRPrimitive(from: _container, forKeyIfPresent: .family, auxiliaryKey: ._family) + self.given = try [FHIRPrimitive](from: _container, forKeyIfPresent: .given, auxiliaryKey: ._given) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.prefix = try [FHIRPrimitive](from: _container, forKeyIfPresent: .prefix, auxiliaryKey: ._prefix) + self.suffix = try [FHIRPrimitive](from: _container, forKeyIfPresent: .suffix, auxiliaryKey: ._suffix) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + self.use = try FHIRPrimitive(from: _container, forKeyIfPresent: .use, auxiliaryKey: ._use) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try family?.encode(on: &_container, forKey: .family, auxiliaryKey: ._family) + try given?.encode(on: &_container, forKey: .given, auxiliaryKey: ._given) + try period?.encode(on: &_container, forKey: .period) + try prefix?.encode(on: &_container, forKey: .prefix, auxiliaryKey: ._prefix) + try suffix?.encode(on: &_container, forKey: .suffix, auxiliaryKey: ._suffix) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try use?.encode(on: &_container, forKey: .use, auxiliaryKey: ._use) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? HumanName else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return family == _other.family + && given == _other.given + && period == _other.period + && prefix == _other.prefix + && suffix == _other.suffix + && text == _other.text + && use == _other.use + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(family) + hasher.combine(given) + hasher.combine(period) + hasher.combine(prefix) + hasher.combine(suffix) + hasher.combine(text) + hasher.combine(use) + } +} diff --git a/Sources/ModelsSTU3/Identifier.swift b/Sources/ModelsSTU3/Identifier.swift new file mode 100644 index 0000000..6d767e5 --- /dev/null +++ b/Sources/ModelsSTU3/Identifier.swift @@ -0,0 +1,139 @@ +// +// Identifier.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Identifier) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + An identifier intended for computation. + + A technical identifier - identifies some entity uniquely and unambiguously. + */ +open class Identifier: Element { + + /// The purpose of this identifier. + public var use: FHIRPrimitive? + + /// Description of identifier + public var type: CodeableConcept? + + /// The namespace for the identifier value + public var system: FHIRPrimitive? + + /// The value that is unique + public var value: FHIRPrimitive? + + /// Time period when id is/was valid for use + public var period: Period? + + /// Organization that issued id (may be just text) + public var assigner: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + assigner: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + period: Period? = nil, + system: FHIRPrimitive? = nil, + type: CodeableConcept? = nil, + use: FHIRPrimitive? = nil, + value: FHIRPrimitive? = nil) + { + self.init() + self.assigner = assigner + self.`extension` = `extension` + self.id = id + self.period = period + self.system = system + self.type = type + self.use = use + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case assigner + case period + case system; case _system + case type + case use; case _use + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.assigner = try Reference(from: _container, forKeyIfPresent: .assigner) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.system = try FHIRPrimitive(from: _container, forKeyIfPresent: .system, auxiliaryKey: ._system) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + self.use = try FHIRPrimitive(from: _container, forKeyIfPresent: .use, auxiliaryKey: ._use) + self.value = try FHIRPrimitive(from: _container, forKeyIfPresent: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try assigner?.encode(on: &_container, forKey: .assigner) + try period?.encode(on: &_container, forKey: .period) + try system?.encode(on: &_container, forKey: .system, auxiliaryKey: ._system) + try type?.encode(on: &_container, forKey: .type) + try use?.encode(on: &_container, forKey: .use, auxiliaryKey: ._use) + try value?.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Identifier else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return assigner == _other.assigner + && period == _other.period + && system == _other.system + && type == _other.type + && use == _other.use + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(assigner) + hasher.combine(period) + hasher.combine(system) + hasher.combine(type) + hasher.combine(use) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/ImagingManifest.swift b/Sources/ModelsSTU3/ImagingManifest.swift new file mode 100644 index 0000000..4b9c09b --- /dev/null +++ b/Sources/ModelsSTU3/ImagingManifest.swift @@ -0,0 +1,427 @@ +// +// ImagingManifest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ImagingManifest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Key Object Selection. + + A text description of the DICOM SOP instances selected in the ImagingManifest; or the reason for, or significance of, + the selection. + */ +open class ImagingManifest: DomainResource { + + override open class var resourceType: ResourceType { return .imagingManifest } + + /// SOP Instance UID + public var identifier: Identifier? + + /// Patient of the selected objects + public var patient: Reference + + /// Time when the selection of instances was made + public var authoringTime: FHIRPrimitive? + + /// Author (human or machine) + public var author: Reference? + + /// Description text + public var description_fhir: FHIRPrimitive? + + /// Study identity of the selected instances + public var study: [ImagingManifestStudy] + + /// Designated initializer taking all required properties + public init(patient: Reference, study: [ImagingManifestStudy]) { + self.patient = patient + self.study = study + super.init() + } + + /// Convenience initializer + public convenience init( + author: Reference? = nil, + authoringTime: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + patient: Reference, + study: [ImagingManifestStudy], + text: Narrative? = nil) + { + self.init(patient: patient, study: study) + self.author = author + self.authoringTime = authoringTime + self.contained = contained + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case author + case authoringTime; case _authoringTime + case description_fhir = "description"; case _description_fhir = "_description" + case identifier + case patient + case study + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.author = try Reference(from: _container, forKeyIfPresent: .author) + self.authoringTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .authoringTime, auxiliaryKey: ._authoringTime) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.patient = try Reference(from: _container, forKey: .patient) + self.study = try [ImagingManifestStudy](from: _container, forKey: .study) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try author?.encode(on: &_container, forKey: .author) + try authoringTime?.encode(on: &_container, forKey: .authoringTime, auxiliaryKey: ._authoringTime) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try identifier?.encode(on: &_container, forKey: .identifier) + try patient.encode(on: &_container, forKey: .patient) + try study.encode(on: &_container, forKey: .study) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImagingManifest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return author == _other.author + && authoringTime == _other.authoringTime + && description_fhir == _other.description_fhir + && identifier == _other.identifier + && patient == _other.patient + && study == _other.study + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(author) + hasher.combine(authoringTime) + hasher.combine(description_fhir) + hasher.combine(identifier) + hasher.combine(patient) + hasher.combine(study) + } +} + +/** + Study identity of the selected instances. + + Study identity and locating information of the DICOM SOP instances in the selection. + */ +open class ImagingManifestStudy: BackboneElement { + + /// Study instance UID + public var uid: FHIRPrimitive + + /// Reference to ImagingStudy + public var imagingStudy: Reference? + + /// Study access service endpoint + public var endpoint: [Reference]? + + /// Series identity of the selected instances + public var series: [ImagingManifestStudySeries] + + /// Designated initializer taking all required properties + public init(series: [ImagingManifestStudySeries], uid: FHIRPrimitive) { + self.series = series + self.uid = uid + super.init() + } + + /// Convenience initializer + public convenience init( + endpoint: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + imagingStudy: Reference? = nil, + modifierExtension: [Extension]? = nil, + series: [ImagingManifestStudySeries], + uid: FHIRPrimitive) + { + self.init(series: series, uid: uid) + self.endpoint = endpoint + self.`extension` = `extension` + self.id = id + self.imagingStudy = imagingStudy + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case endpoint + case imagingStudy + case series + case uid; case _uid + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.endpoint = try [Reference](from: _container, forKeyIfPresent: .endpoint) + self.imagingStudy = try Reference(from: _container, forKeyIfPresent: .imagingStudy) + self.series = try [ImagingManifestStudySeries](from: _container, forKey: .series) + self.uid = try FHIRPrimitive(from: _container, forKey: .uid, auxiliaryKey: ._uid) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try endpoint?.encode(on: &_container, forKey: .endpoint) + try imagingStudy?.encode(on: &_container, forKey: .imagingStudy) + try series.encode(on: &_container, forKey: .series) + try uid.encode(on: &_container, forKey: .uid, auxiliaryKey: ._uid) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImagingManifestStudy else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return endpoint == _other.endpoint + && imagingStudy == _other.imagingStudy + && series == _other.series + && uid == _other.uid + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(endpoint) + hasher.combine(imagingStudy) + hasher.combine(series) + hasher.combine(uid) + } +} + +/** + Series identity of the selected instances. + + Series identity and locating information of the DICOM SOP instances in the selection. + */ +open class ImagingManifestStudySeries: BackboneElement { + + /// Series instance UID + public var uid: FHIRPrimitive + + /// Series access endpoint + public var endpoint: [Reference]? + + /// The selected instance + public var instance: [ImagingManifestStudySeriesInstance] + + /// Designated initializer taking all required properties + public init(instance: [ImagingManifestStudySeriesInstance], uid: FHIRPrimitive) { + self.instance = instance + self.uid = uid + super.init() + } + + /// Convenience initializer + public convenience init( + endpoint: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + instance: [ImagingManifestStudySeriesInstance], + modifierExtension: [Extension]? = nil, + uid: FHIRPrimitive) + { + self.init(instance: instance, uid: uid) + self.endpoint = endpoint + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case endpoint + case instance + case uid; case _uid + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.endpoint = try [Reference](from: _container, forKeyIfPresent: .endpoint) + self.instance = try [ImagingManifestStudySeriesInstance](from: _container, forKey: .instance) + self.uid = try FHIRPrimitive(from: _container, forKey: .uid, auxiliaryKey: ._uid) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try endpoint?.encode(on: &_container, forKey: .endpoint) + try instance.encode(on: &_container, forKey: .instance) + try uid.encode(on: &_container, forKey: .uid, auxiliaryKey: ._uid) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImagingManifestStudySeries else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return endpoint == _other.endpoint + && instance == _other.instance + && uid == _other.uid + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(endpoint) + hasher.combine(instance) + hasher.combine(uid) + } +} + +/** + The selected instance. + + Identity and locating information of the selected DICOM SOP instances. + */ +open class ImagingManifestStudySeriesInstance: BackboneElement { + + /// SOP class UID of instance + public var sopClass: FHIRPrimitive + + /// Selected instance UID + public var uid: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(sopClass: FHIRPrimitive, uid: FHIRPrimitive) { + self.sopClass = sopClass + self.uid = uid + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + sopClass: FHIRPrimitive, + uid: FHIRPrimitive) + { + self.init(sopClass: sopClass, uid: uid) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case sopClass; case _sopClass + case uid; case _uid + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.sopClass = try FHIRPrimitive(from: _container, forKey: .sopClass, auxiliaryKey: ._sopClass) + self.uid = try FHIRPrimitive(from: _container, forKey: .uid, auxiliaryKey: ._uid) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try sopClass.encode(on: &_container, forKey: .sopClass, auxiliaryKey: ._sopClass) + try uid.encode(on: &_container, forKey: .uid, auxiliaryKey: ._uid) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImagingManifestStudySeriesInstance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return sopClass == _other.sopClass + && uid == _other.uid + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(sopClass) + hasher.combine(uid) + } +} diff --git a/Sources/ModelsSTU3/ImagingStudy.swift b/Sources/ModelsSTU3/ImagingStudy.swift new file mode 100644 index 0000000..9ccbde4 --- /dev/null +++ b/Sources/ModelsSTU3/ImagingStudy.swift @@ -0,0 +1,568 @@ +// +// ImagingStudy.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ImagingStudy) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A set of images produced in single study (one or more series of references images). + + Representation of the content produced in a DICOM imaging study. A study comprises a set of series, each of which + includes a set of Service-Object Pair Instances (SOP Instances - images or other data) acquired or produced in a common + context. A series is of only one modality (e.g. X-ray, CT, MR, ultrasound), but a study may have multiple series of + different modalities. + */ +open class ImagingStudy: DomainResource { + + override open class var resourceType: ResourceType { return .imagingStudy } + + /// Formal DICOM identifier for the study + public var uid: FHIRPrimitive + + /// Related workflow identifier ("Accession Number") + public var accession: Identifier? + + /// Other identifiers for the study + public var identifier: [Identifier]? + + /// ONLINE | OFFLINE | NEARLINE | UNAVAILABLE + public var availability: FHIRPrimitive? + + /// All series modality if actual acquisition modalities + public var modalityList: [Coding]? + + /// Who the images are of + public var patient: Reference + + /// Originating context + public var context: Reference? + + /// When the study was started + public var started: FHIRPrimitive? + + /// Request fulfilled + public var basedOn: [Reference]? + + /// Referring physician + public var referrer: Reference? + + /// Who interpreted images + public var interpreter: [Reference]? + + /// Study access endpoint + public var endpoint: [Reference]? + + /// Number of Study Related Series + public var numberOfSeries: FHIRPrimitive? + + /// Number of Study Related Instances + public var numberOfInstances: FHIRPrimitive? + + /// The performed Procedure reference + public var procedureReference: [Reference]? + + /// The performed procedure code + public var procedureCode: [CodeableConcept]? + + /// Why the study was requested + public var reason: CodeableConcept? + + /// Institution-generated description + public var description_fhir: FHIRPrimitive? + + /// Each study has one or more series of instances + public var series: [ImagingStudySeries]? + + /// Designated initializer taking all required properties + public init(patient: Reference, uid: FHIRPrimitive) { + self.patient = patient + self.uid = uid + super.init() + } + + /// Convenience initializer + public convenience init( + accession: Identifier? = nil, + availability: FHIRPrimitive? = nil, + basedOn: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + description_fhir: FHIRPrimitive? = nil, + endpoint: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + interpreter: [Reference]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modalityList: [Coding]? = nil, + modifierExtension: [Extension]? = nil, + numberOfInstances: FHIRPrimitive? = nil, + numberOfSeries: FHIRPrimitive? = nil, + patient: Reference, + procedureCode: [CodeableConcept]? = nil, + procedureReference: [Reference]? = nil, + reason: CodeableConcept? = nil, + referrer: Reference? = nil, + series: [ImagingStudySeries]? = nil, + started: FHIRPrimitive? = nil, + text: Narrative? = nil, + uid: FHIRPrimitive) + { + self.init(patient: patient, uid: uid) + self.accession = accession + self.availability = availability + self.basedOn = basedOn + self.contained = contained + self.context = context + self.description_fhir = description_fhir + self.endpoint = endpoint + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.interpreter = interpreter + self.language = language + self.meta = meta + self.modalityList = modalityList + self.modifierExtension = modifierExtension + self.numberOfInstances = numberOfInstances + self.numberOfSeries = numberOfSeries + self.procedureCode = procedureCode + self.procedureReference = procedureReference + self.reason = reason + self.referrer = referrer + self.series = series + self.started = started + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case accession + case availability; case _availability + case basedOn + case context + case description_fhir = "description"; case _description_fhir = "_description" + case endpoint + case identifier + case interpreter + case modalityList + case numberOfInstances; case _numberOfInstances + case numberOfSeries; case _numberOfSeries + case patient + case procedureCode + case procedureReference + case reason + case referrer + case series + case started; case _started + case uid; case _uid + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.accession = try Identifier(from: _container, forKeyIfPresent: .accession) + self.availability = try FHIRPrimitive(from: _container, forKeyIfPresent: .availability, auxiliaryKey: ._availability) + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.endpoint = try [Reference](from: _container, forKeyIfPresent: .endpoint) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.interpreter = try [Reference](from: _container, forKeyIfPresent: .interpreter) + self.modalityList = try [Coding](from: _container, forKeyIfPresent: .modalityList) + self.numberOfInstances = try FHIRPrimitive(from: _container, forKeyIfPresent: .numberOfInstances, auxiliaryKey: ._numberOfInstances) + self.numberOfSeries = try FHIRPrimitive(from: _container, forKeyIfPresent: .numberOfSeries, auxiliaryKey: ._numberOfSeries) + self.patient = try Reference(from: _container, forKey: .patient) + self.procedureCode = try [CodeableConcept](from: _container, forKeyIfPresent: .procedureCode) + self.procedureReference = try [Reference](from: _container, forKeyIfPresent: .procedureReference) + self.reason = try CodeableConcept(from: _container, forKeyIfPresent: .reason) + self.referrer = try Reference(from: _container, forKeyIfPresent: .referrer) + self.series = try [ImagingStudySeries](from: _container, forKeyIfPresent: .series) + self.started = try FHIRPrimitive(from: _container, forKeyIfPresent: .started, auxiliaryKey: ._started) + self.uid = try FHIRPrimitive(from: _container, forKey: .uid, auxiliaryKey: ._uid) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try accession?.encode(on: &_container, forKey: .accession) + try availability?.encode(on: &_container, forKey: .availability, auxiliaryKey: ._availability) + try basedOn?.encode(on: &_container, forKey: .basedOn) + try context?.encode(on: &_container, forKey: .context) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try endpoint?.encode(on: &_container, forKey: .endpoint) + try identifier?.encode(on: &_container, forKey: .identifier) + try interpreter?.encode(on: &_container, forKey: .interpreter) + try modalityList?.encode(on: &_container, forKey: .modalityList) + try numberOfInstances?.encode(on: &_container, forKey: .numberOfInstances, auxiliaryKey: ._numberOfInstances) + try numberOfSeries?.encode(on: &_container, forKey: .numberOfSeries, auxiliaryKey: ._numberOfSeries) + try patient.encode(on: &_container, forKey: .patient) + try procedureCode?.encode(on: &_container, forKey: .procedureCode) + try procedureReference?.encode(on: &_container, forKey: .procedureReference) + try reason?.encode(on: &_container, forKey: .reason) + try referrer?.encode(on: &_container, forKey: .referrer) + try series?.encode(on: &_container, forKey: .series) + try started?.encode(on: &_container, forKey: .started, auxiliaryKey: ._started) + try uid.encode(on: &_container, forKey: .uid, auxiliaryKey: ._uid) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImagingStudy else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return accession == _other.accession + && availability == _other.availability + && basedOn == _other.basedOn + && context == _other.context + && description_fhir == _other.description_fhir + && endpoint == _other.endpoint + && identifier == _other.identifier + && interpreter == _other.interpreter + && modalityList == _other.modalityList + && numberOfInstances == _other.numberOfInstances + && numberOfSeries == _other.numberOfSeries + && patient == _other.patient + && procedureCode == _other.procedureCode + && procedureReference == _other.procedureReference + && reason == _other.reason + && referrer == _other.referrer + && series == _other.series + && started == _other.started + && uid == _other.uid + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(accession) + hasher.combine(availability) + hasher.combine(basedOn) + hasher.combine(context) + hasher.combine(description_fhir) + hasher.combine(endpoint) + hasher.combine(identifier) + hasher.combine(interpreter) + hasher.combine(modalityList) + hasher.combine(numberOfInstances) + hasher.combine(numberOfSeries) + hasher.combine(patient) + hasher.combine(procedureCode) + hasher.combine(procedureReference) + hasher.combine(reason) + hasher.combine(referrer) + hasher.combine(series) + hasher.combine(started) + hasher.combine(uid) + } +} + +/** + Each study has one or more series of instances. + + Each study has one or more series of images or other content. + */ +open class ImagingStudySeries: BackboneElement { + + /// Formal DICOM identifier for this series + public var uid: FHIRPrimitive + + /// Numeric identifier of this series + public var number: FHIRPrimitive? + + /// The modality of the instances in the series + public var modality: Coding + + /// A short human readable summary of the series + public var description_fhir: FHIRPrimitive? + + /// Number of Series Related Instances + public var numberOfInstances: FHIRPrimitive? + + /// ONLINE | OFFLINE | NEARLINE | UNAVAILABLE + public var availability: FHIRPrimitive? + + /// Series access endpoint + public var endpoint: [Reference]? + + /// Body part examined + public var bodySite: Coding? + + /// Body part laterality + public var laterality: Coding? + + /// When the series started + public var started: FHIRPrimitive? + + /// Who performed the series + public var performer: [Reference]? + + /// A single SOP instance from the series + public var instance: [ImagingStudySeriesInstance]? + + /// Designated initializer taking all required properties + public init(modality: Coding, uid: FHIRPrimitive) { + self.modality = modality + self.uid = uid + super.init() + } + + /// Convenience initializer + public convenience init( + availability: FHIRPrimitive? = nil, + bodySite: Coding? = nil, + description_fhir: FHIRPrimitive? = nil, + endpoint: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + instance: [ImagingStudySeriesInstance]? = nil, + laterality: Coding? = nil, + modality: Coding, + modifierExtension: [Extension]? = nil, + number: FHIRPrimitive? = nil, + numberOfInstances: FHIRPrimitive? = nil, + performer: [Reference]? = nil, + started: FHIRPrimitive? = nil, + uid: FHIRPrimitive) + { + self.init(modality: modality, uid: uid) + self.availability = availability + self.bodySite = bodySite + self.description_fhir = description_fhir + self.endpoint = endpoint + self.`extension` = `extension` + self.id = id + self.instance = instance + self.laterality = laterality + self.modifierExtension = modifierExtension + self.number = number + self.numberOfInstances = numberOfInstances + self.performer = performer + self.started = started + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case availability; case _availability + case bodySite + case description_fhir = "description"; case _description_fhir = "_description" + case endpoint + case instance + case laterality + case modality + case number; case _number + case numberOfInstances; case _numberOfInstances + case performer + case started; case _started + case uid; case _uid + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.availability = try FHIRPrimitive(from: _container, forKeyIfPresent: .availability, auxiliaryKey: ._availability) + self.bodySite = try Coding(from: _container, forKeyIfPresent: .bodySite) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.endpoint = try [Reference](from: _container, forKeyIfPresent: .endpoint) + self.instance = try [ImagingStudySeriesInstance](from: _container, forKeyIfPresent: .instance) + self.laterality = try Coding(from: _container, forKeyIfPresent: .laterality) + self.modality = try Coding(from: _container, forKey: .modality) + self.number = try FHIRPrimitive(from: _container, forKeyIfPresent: .number, auxiliaryKey: ._number) + self.numberOfInstances = try FHIRPrimitive(from: _container, forKeyIfPresent: .numberOfInstances, auxiliaryKey: ._numberOfInstances) + self.performer = try [Reference](from: _container, forKeyIfPresent: .performer) + self.started = try FHIRPrimitive(from: _container, forKeyIfPresent: .started, auxiliaryKey: ._started) + self.uid = try FHIRPrimitive(from: _container, forKey: .uid, auxiliaryKey: ._uid) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try availability?.encode(on: &_container, forKey: .availability, auxiliaryKey: ._availability) + try bodySite?.encode(on: &_container, forKey: .bodySite) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try endpoint?.encode(on: &_container, forKey: .endpoint) + try instance?.encode(on: &_container, forKey: .instance) + try laterality?.encode(on: &_container, forKey: .laterality) + try modality.encode(on: &_container, forKey: .modality) + try number?.encode(on: &_container, forKey: .number, auxiliaryKey: ._number) + try numberOfInstances?.encode(on: &_container, forKey: .numberOfInstances, auxiliaryKey: ._numberOfInstances) + try performer?.encode(on: &_container, forKey: .performer) + try started?.encode(on: &_container, forKey: .started, auxiliaryKey: ._started) + try uid.encode(on: &_container, forKey: .uid, auxiliaryKey: ._uid) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImagingStudySeries else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return availability == _other.availability + && bodySite == _other.bodySite + && description_fhir == _other.description_fhir + && endpoint == _other.endpoint + && instance == _other.instance + && laterality == _other.laterality + && modality == _other.modality + && number == _other.number + && numberOfInstances == _other.numberOfInstances + && performer == _other.performer + && started == _other.started + && uid == _other.uid + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(availability) + hasher.combine(bodySite) + hasher.combine(description_fhir) + hasher.combine(endpoint) + hasher.combine(instance) + hasher.combine(laterality) + hasher.combine(modality) + hasher.combine(number) + hasher.combine(numberOfInstances) + hasher.combine(performer) + hasher.combine(started) + hasher.combine(uid) + } +} + +/** + A single SOP instance from the series. + + A single SOP instance within the series, e.g. an image, or presentation state. + */ +open class ImagingStudySeriesInstance: BackboneElement { + + /// Formal DICOM identifier for this instance + public var uid: FHIRPrimitive + + /// The number of this instance in the series + public var number: FHIRPrimitive? + + /// DICOM class type + public var sopClass: FHIRPrimitive + + /// Description of instance + public var title: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(sopClass: FHIRPrimitive, uid: FHIRPrimitive) { + self.sopClass = sopClass + self.uid = uid + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + number: FHIRPrimitive? = nil, + sopClass: FHIRPrimitive, + title: FHIRPrimitive? = nil, + uid: FHIRPrimitive) + { + self.init(sopClass: sopClass, uid: uid) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.number = number + self.title = title + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case number; case _number + case sopClass; case _sopClass + case title; case _title + case uid; case _uid + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.number = try FHIRPrimitive(from: _container, forKeyIfPresent: .number, auxiliaryKey: ._number) + self.sopClass = try FHIRPrimitive(from: _container, forKey: .sopClass, auxiliaryKey: ._sopClass) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.uid = try FHIRPrimitive(from: _container, forKey: .uid, auxiliaryKey: ._uid) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try number?.encode(on: &_container, forKey: .number, auxiliaryKey: ._number) + try sopClass.encode(on: &_container, forKey: .sopClass, auxiliaryKey: ._sopClass) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try uid.encode(on: &_container, forKey: .uid, auxiliaryKey: ._uid) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImagingStudySeriesInstance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return number == _other.number + && sopClass == _other.sopClass + && title == _other.title + && uid == _other.uid + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(number) + hasher.combine(sopClass) + hasher.combine(title) + hasher.combine(uid) + } +} diff --git a/Sources/ModelsSTU3/Immunization.swift b/Sources/ModelsSTU3/Immunization.swift new file mode 100644 index 0000000..9bd9863 --- /dev/null +++ b/Sources/ModelsSTU3/Immunization.swift @@ -0,0 +1,700 @@ +// +// Immunization.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Immunization) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Immunization event information. + + Describes the event of a patient being administered a vaccination or a record of a vaccination as reported by a + patient, a clinician or another party and may include vaccine reaction information and what vaccination protocol was + followed. + */ +open class Immunization: DomainResource { + + override open class var resourceType: ResourceType { return .immunization } + + /// Business identifier + public var identifier: [Identifier]? + + /// Indicates the current status of the vaccination event. + /// Restricted to: ['completed', 'entered-in-error'] + public var status: FHIRPrimitive + + /// Flag for whether immunization was given + public var notGiven: FHIRPrimitive + + /// Vaccine product administered + public var vaccineCode: CodeableConcept + + /// Who was immunized + public var patient: Reference + + /// Encounter administered as part of + public var encounter: Reference? + + /// Vaccination administration date + public var date: FHIRPrimitive? + + /// Indicates context the data was recorded in + public var primarySource: FHIRPrimitive + + /// Indicates the source of a secondarily reported record + public var reportOrigin: CodeableConcept? + + /// Where vaccination occurred + public var location: Reference? + + /// Vaccine manufacturer + public var manufacturer: Reference? + + /// Vaccine lot number + public var lotNumber: FHIRPrimitive? + + /// Vaccine expiration date + public var expirationDate: FHIRPrimitive? + + /// Body site vaccine was administered + public var site: CodeableConcept? + + /// How vaccine entered body + public var route: CodeableConcept? + + /// Amount of vaccine administered + public var doseQuantity: Quantity? + + /// Who performed event + public var practitioner: [ImmunizationPractitioner]? + + /// Vaccination notes + public var note: [Annotation]? + + /// Administration/non-administration reasons + public var explanation: ImmunizationExplanation? + + /// Details of a reaction that follows immunization + public var reaction: [ImmunizationReaction]? + + /// What protocol was followed + public var vaccinationProtocol: [ImmunizationVaccinationProtocol]? + + /// Designated initializer taking all required properties + public init(notGiven: FHIRPrimitive, patient: Reference, primarySource: FHIRPrimitive, status: FHIRPrimitive, vaccineCode: CodeableConcept) { + self.notGiven = notGiven + self.patient = patient + self.primarySource = primarySource + self.status = status + self.vaccineCode = vaccineCode + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + doseQuantity: Quantity? = nil, + encounter: Reference? = nil, + expirationDate: FHIRPrimitive? = nil, + explanation: ImmunizationExplanation? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + location: Reference? = nil, + lotNumber: FHIRPrimitive? = nil, + manufacturer: Reference? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + notGiven: FHIRPrimitive, + note: [Annotation]? = nil, + patient: Reference, + practitioner: [ImmunizationPractitioner]? = nil, + primarySource: FHIRPrimitive, + reaction: [ImmunizationReaction]? = nil, + reportOrigin: CodeableConcept? = nil, + route: CodeableConcept? = nil, + site: CodeableConcept? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + vaccinationProtocol: [ImmunizationVaccinationProtocol]? = nil, + vaccineCode: CodeableConcept) + { + self.init(notGiven: notGiven, patient: patient, primarySource: primarySource, status: status, vaccineCode: vaccineCode) + self.contained = contained + self.date = date + self.doseQuantity = doseQuantity + self.encounter = encounter + self.expirationDate = expirationDate + self.explanation = explanation + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.location = location + self.lotNumber = lotNumber + self.manufacturer = manufacturer + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.practitioner = practitioner + self.reaction = reaction + self.reportOrigin = reportOrigin + self.route = route + self.site = site + self.text = text + self.vaccinationProtocol = vaccinationProtocol + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case date; case _date + case doseQuantity + case encounter + case expirationDate; case _expirationDate + case explanation + case identifier + case location + case lotNumber; case _lotNumber + case manufacturer + case notGiven; case _notGiven + case note + case patient + case practitioner + case primarySource; case _primarySource + case reaction + case reportOrigin + case route + case site + case status; case _status + case vaccinationProtocol + case vaccineCode + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.doseQuantity = try Quantity(from: _container, forKeyIfPresent: .doseQuantity) + self.encounter = try Reference(from: _container, forKeyIfPresent: .encounter) + self.expirationDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .expirationDate, auxiliaryKey: ._expirationDate) + self.explanation = try ImmunizationExplanation(from: _container, forKeyIfPresent: .explanation) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.location = try Reference(from: _container, forKeyIfPresent: .location) + self.lotNumber = try FHIRPrimitive(from: _container, forKeyIfPresent: .lotNumber, auxiliaryKey: ._lotNumber) + self.manufacturer = try Reference(from: _container, forKeyIfPresent: .manufacturer) + self.notGiven = try FHIRPrimitive(from: _container, forKey: .notGiven, auxiliaryKey: ._notGiven) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.patient = try Reference(from: _container, forKey: .patient) + self.practitioner = try [ImmunizationPractitioner](from: _container, forKeyIfPresent: .practitioner) + self.primarySource = try FHIRPrimitive(from: _container, forKey: .primarySource, auxiliaryKey: ._primarySource) + self.reaction = try [ImmunizationReaction](from: _container, forKeyIfPresent: .reaction) + self.reportOrigin = try CodeableConcept(from: _container, forKeyIfPresent: .reportOrigin) + self.route = try CodeableConcept(from: _container, forKeyIfPresent: .route) + self.site = try CodeableConcept(from: _container, forKeyIfPresent: .site) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.vaccinationProtocol = try [ImmunizationVaccinationProtocol](from: _container, forKeyIfPresent: .vaccinationProtocol) + self.vaccineCode = try CodeableConcept(from: _container, forKey: .vaccineCode) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try doseQuantity?.encode(on: &_container, forKey: .doseQuantity) + try encounter?.encode(on: &_container, forKey: .encounter) + try expirationDate?.encode(on: &_container, forKey: .expirationDate, auxiliaryKey: ._expirationDate) + try explanation?.encode(on: &_container, forKey: .explanation) + try identifier?.encode(on: &_container, forKey: .identifier) + try location?.encode(on: &_container, forKey: .location) + try lotNumber?.encode(on: &_container, forKey: .lotNumber, auxiliaryKey: ._lotNumber) + try manufacturer?.encode(on: &_container, forKey: .manufacturer) + try notGiven.encode(on: &_container, forKey: .notGiven, auxiliaryKey: ._notGiven) + try note?.encode(on: &_container, forKey: .note) + try patient.encode(on: &_container, forKey: .patient) + try practitioner?.encode(on: &_container, forKey: .practitioner) + try primarySource.encode(on: &_container, forKey: .primarySource, auxiliaryKey: ._primarySource) + try reaction?.encode(on: &_container, forKey: .reaction) + try reportOrigin?.encode(on: &_container, forKey: .reportOrigin) + try route?.encode(on: &_container, forKey: .route) + try site?.encode(on: &_container, forKey: .site) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try vaccinationProtocol?.encode(on: &_container, forKey: .vaccinationProtocol) + try vaccineCode.encode(on: &_container, forKey: .vaccineCode) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Immunization else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return date == _other.date + && doseQuantity == _other.doseQuantity + && encounter == _other.encounter + && expirationDate == _other.expirationDate + && explanation == _other.explanation + && identifier == _other.identifier + && location == _other.location + && lotNumber == _other.lotNumber + && manufacturer == _other.manufacturer + && notGiven == _other.notGiven + && note == _other.note + && patient == _other.patient + && practitioner == _other.practitioner + && primarySource == _other.primarySource + && reaction == _other.reaction + && reportOrigin == _other.reportOrigin + && route == _other.route + && site == _other.site + && status == _other.status + && vaccinationProtocol == _other.vaccinationProtocol + && vaccineCode == _other.vaccineCode + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(date) + hasher.combine(doseQuantity) + hasher.combine(encounter) + hasher.combine(expirationDate) + hasher.combine(explanation) + hasher.combine(identifier) + hasher.combine(location) + hasher.combine(lotNumber) + hasher.combine(manufacturer) + hasher.combine(notGiven) + hasher.combine(note) + hasher.combine(patient) + hasher.combine(practitioner) + hasher.combine(primarySource) + hasher.combine(reaction) + hasher.combine(reportOrigin) + hasher.combine(route) + hasher.combine(site) + hasher.combine(status) + hasher.combine(vaccinationProtocol) + hasher.combine(vaccineCode) + } +} + +/** + Administration/non-administration reasons. + + Reasons why a vaccine was or was not administered. + */ +open class ImmunizationExplanation: BackboneElement { + + /// Why immunization occurred + public var reason: [CodeableConcept]? + + /// Why immunization did not occur + public var reasonNotGiven: [CodeableConcept]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reason: [CodeableConcept]? = nil, + reasonNotGiven: [CodeableConcept]? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reason = reason + self.reasonNotGiven = reasonNotGiven + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case reason + case reasonNotGiven + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.reason = try [CodeableConcept](from: _container, forKeyIfPresent: .reason) + self.reasonNotGiven = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonNotGiven) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try reason?.encode(on: &_container, forKey: .reason) + try reasonNotGiven?.encode(on: &_container, forKey: .reasonNotGiven) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImmunizationExplanation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return reason == _other.reason + && reasonNotGiven == _other.reasonNotGiven + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(reason) + hasher.combine(reasonNotGiven) + } +} + +/** + Who performed event. + + Indicates who or what performed the event. + */ +open class ImmunizationPractitioner: BackboneElement { + + /// What type of performance was done + public var role: CodeableConcept? + + /// Individual who was performing + public var actor: Reference + + /// Designated initializer taking all required properties + public init(actor: Reference) { + self.actor = actor + super.init() + } + + /// Convenience initializer + public convenience init( + actor: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + role: CodeableConcept? = nil) + { + self.init(actor: actor) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actor + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actor = try Reference(from: _container, forKey: .actor) + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actor.encode(on: &_container, forKey: .actor) + try role?.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImmunizationPractitioner else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actor == _other.actor + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actor) + hasher.combine(role) + } +} + +/** + Details of a reaction that follows immunization. + + Categorical data indicating that an adverse event is associated in time to an immunization. + */ +open class ImmunizationReaction: BackboneElement { + + /// When reaction started + public var date: FHIRPrimitive? + + /// Additional information on reaction + public var detail: Reference? + + /// Indicates self-reported reaction + public var reported: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + date: FHIRPrimitive? = nil, + detail: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reported: FHIRPrimitive? = nil) + { + self.init() + self.date = date + self.detail = detail + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reported = reported + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case date; case _date + case detail + case reported; case _reported + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.detail = try Reference(from: _container, forKeyIfPresent: .detail) + self.reported = try FHIRPrimitive(from: _container, forKeyIfPresent: .reported, auxiliaryKey: ._reported) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try detail?.encode(on: &_container, forKey: .detail) + try reported?.encode(on: &_container, forKey: .reported, auxiliaryKey: ._reported) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImmunizationReaction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return date == _other.date + && detail == _other.detail + && reported == _other.reported + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(date) + hasher.combine(detail) + hasher.combine(reported) + } +} + +/** + What protocol was followed. + + Contains information about the protocol(s) under which the vaccine was administered. + */ +open class ImmunizationVaccinationProtocol: BackboneElement { + + /// Dose number within series + public var doseSequence: FHIRPrimitive? + + /// Details of vaccine protocol + public var description_fhir: FHIRPrimitive? + + /// Who is responsible for protocol + public var authority: Reference? + + /// Name of vaccine series + public var series: FHIRPrimitive? + + /// Recommended number of doses for immunity + public var seriesDoses: FHIRPrimitive? + + /// Disease immunized against + public var targetDisease: [CodeableConcept] + + /// Indicates if dose counts towards immunity + public var doseStatus: CodeableConcept + + /// Why dose does (not) count + public var doseStatusReason: CodeableConcept? + + /// Designated initializer taking all required properties + public init(doseStatus: CodeableConcept, targetDisease: [CodeableConcept]) { + self.doseStatus = doseStatus + self.targetDisease = targetDisease + super.init() + } + + /// Convenience initializer + public convenience init( + authority: Reference? = nil, + description_fhir: FHIRPrimitive? = nil, + doseSequence: FHIRPrimitive? = nil, + doseStatus: CodeableConcept, + doseStatusReason: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + series: FHIRPrimitive? = nil, + seriesDoses: FHIRPrimitive? = nil, + targetDisease: [CodeableConcept]) + { + self.init(doseStatus: doseStatus, targetDisease: targetDisease) + self.authority = authority + self.description_fhir = description_fhir + self.doseSequence = doseSequence + self.doseStatusReason = doseStatusReason + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.series = series + self.seriesDoses = seriesDoses + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authority + case description_fhir = "description"; case _description_fhir = "_description" + case doseSequence; case _doseSequence + case doseStatus + case doseStatusReason + case series; case _series + case seriesDoses; case _seriesDoses + case targetDisease + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.authority = try Reference(from: _container, forKeyIfPresent: .authority) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.doseSequence = try FHIRPrimitive(from: _container, forKeyIfPresent: .doseSequence, auxiliaryKey: ._doseSequence) + self.doseStatus = try CodeableConcept(from: _container, forKey: .doseStatus) + self.doseStatusReason = try CodeableConcept(from: _container, forKeyIfPresent: .doseStatusReason) + self.series = try FHIRPrimitive(from: _container, forKeyIfPresent: .series, auxiliaryKey: ._series) + self.seriesDoses = try FHIRPrimitive(from: _container, forKeyIfPresent: .seriesDoses, auxiliaryKey: ._seriesDoses) + self.targetDisease = try [CodeableConcept](from: _container, forKey: .targetDisease) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authority?.encode(on: &_container, forKey: .authority) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try doseSequence?.encode(on: &_container, forKey: .doseSequence, auxiliaryKey: ._doseSequence) + try doseStatus.encode(on: &_container, forKey: .doseStatus) + try doseStatusReason?.encode(on: &_container, forKey: .doseStatusReason) + try series?.encode(on: &_container, forKey: .series, auxiliaryKey: ._series) + try seriesDoses?.encode(on: &_container, forKey: .seriesDoses, auxiliaryKey: ._seriesDoses) + try targetDisease.encode(on: &_container, forKey: .targetDisease) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImmunizationVaccinationProtocol else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authority == _other.authority + && description_fhir == _other.description_fhir + && doseSequence == _other.doseSequence + && doseStatus == _other.doseStatus + && doseStatusReason == _other.doseStatusReason + && series == _other.series + && seriesDoses == _other.seriesDoses + && targetDisease == _other.targetDisease + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authority) + hasher.combine(description_fhir) + hasher.combine(doseSequence) + hasher.combine(doseStatus) + hasher.combine(doseStatusReason) + hasher.combine(series) + hasher.combine(seriesDoses) + hasher.combine(targetDisease) + } +} diff --git a/Sources/ModelsSTU3/ImmunizationRecommendation.swift b/Sources/ModelsSTU3/ImmunizationRecommendation.swift new file mode 100644 index 0000000..649ef73 --- /dev/null +++ b/Sources/ModelsSTU3/ImmunizationRecommendation.swift @@ -0,0 +1,455 @@ +// +// ImmunizationRecommendation.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Guidance or advice relating to an immunization. + + A patient's point-in-time immunization and recommendation (i.e. forecasting a patient's immunization eligibility + according to a published schedule) with optional supporting justification. + */ +open class ImmunizationRecommendation: DomainResource { + + override open class var resourceType: ResourceType { return .immunizationRecommendation } + + /// Business identifier + public var identifier: [Identifier]? + + /// Who this profile is for + public var patient: Reference + + /// Vaccine administration recommendations + public var recommendation: [ImmunizationRecommendationRecommendation] + + /// Designated initializer taking all required properties + public init(patient: Reference, recommendation: [ImmunizationRecommendationRecommendation]) { + self.patient = patient + self.recommendation = recommendation + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + patient: Reference, + recommendation: [ImmunizationRecommendationRecommendation], + text: Narrative? = nil) + { + self.init(patient: patient, recommendation: recommendation) + self.contained = contained + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case identifier + case patient + case recommendation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.patient = try Reference(from: _container, forKey: .patient) + self.recommendation = try [ImmunizationRecommendationRecommendation](from: _container, forKey: .recommendation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try identifier?.encode(on: &_container, forKey: .identifier) + try patient.encode(on: &_container, forKey: .patient) + try recommendation.encode(on: &_container, forKey: .recommendation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImmunizationRecommendation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return identifier == _other.identifier + && patient == _other.patient + && recommendation == _other.recommendation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(identifier) + hasher.combine(patient) + hasher.combine(recommendation) + } +} + +/** + Vaccine administration recommendations. + */ +open class ImmunizationRecommendationRecommendation: BackboneElement { + + /// Date recommendation created + public var date: FHIRPrimitive + + /// Vaccine recommendation applies to + public var vaccineCode: CodeableConcept? + + /// Disease to be immunized against + public var targetDisease: CodeableConcept? + + /// Recommended dose number + public var doseNumber: FHIRPrimitive? + + /// Vaccine administration status + public var forecastStatus: CodeableConcept + + /// Dates governing proposed immunization + public var dateCriterion: [ImmunizationRecommendationRecommendationDateCriterion]? + + /// Protocol used by recommendation + public var `protocol`: ImmunizationRecommendationRecommendationProtocol? + + /// Past immunizations supporting recommendation + public var supportingImmunization: [Reference]? + + /// Patient observations supporting recommendation + public var supportingPatientInformation: [Reference]? + + /// Designated initializer taking all required properties + public init(date: FHIRPrimitive, forecastStatus: CodeableConcept) { + self.date = date + self.forecastStatus = forecastStatus + super.init() + } + + /// Convenience initializer + public convenience init( + date: FHIRPrimitive, + dateCriterion: [ImmunizationRecommendationRecommendationDateCriterion]? = nil, + doseNumber: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + forecastStatus: CodeableConcept, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + `protocol`: ImmunizationRecommendationRecommendationProtocol? = nil, + supportingImmunization: [Reference]? = nil, + supportingPatientInformation: [Reference]? = nil, + targetDisease: CodeableConcept? = nil, + vaccineCode: CodeableConcept? = nil) + { + self.init(date: date, forecastStatus: forecastStatus) + self.dateCriterion = dateCriterion + self.doseNumber = doseNumber + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.`protocol` = `protocol` + self.supportingImmunization = supportingImmunization + self.supportingPatientInformation = supportingPatientInformation + self.targetDisease = targetDisease + self.vaccineCode = vaccineCode + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case date; case _date + case dateCriterion + case doseNumber; case _doseNumber + case forecastStatus + case `protocol` = "protocol" + case supportingImmunization + case supportingPatientInformation + case targetDisease + case vaccineCode + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.date = try FHIRPrimitive(from: _container, forKey: .date, auxiliaryKey: ._date) + self.dateCriterion = try [ImmunizationRecommendationRecommendationDateCriterion](from: _container, forKeyIfPresent: .dateCriterion) + self.doseNumber = try FHIRPrimitive(from: _container, forKeyIfPresent: .doseNumber, auxiliaryKey: ._doseNumber) + self.forecastStatus = try CodeableConcept(from: _container, forKey: .forecastStatus) + self.`protocol` = try ImmunizationRecommendationRecommendationProtocol(from: _container, forKeyIfPresent: .`protocol`) + self.supportingImmunization = try [Reference](from: _container, forKeyIfPresent: .supportingImmunization) + self.supportingPatientInformation = try [Reference](from: _container, forKeyIfPresent: .supportingPatientInformation) + self.targetDisease = try CodeableConcept(from: _container, forKeyIfPresent: .targetDisease) + self.vaccineCode = try CodeableConcept(from: _container, forKeyIfPresent: .vaccineCode) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try date.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try dateCriterion?.encode(on: &_container, forKey: .dateCriterion) + try doseNumber?.encode(on: &_container, forKey: .doseNumber, auxiliaryKey: ._doseNumber) + try forecastStatus.encode(on: &_container, forKey: .forecastStatus) + try `protocol`?.encode(on: &_container, forKey: .`protocol`) + try supportingImmunization?.encode(on: &_container, forKey: .supportingImmunization) + try supportingPatientInformation?.encode(on: &_container, forKey: .supportingPatientInformation) + try targetDisease?.encode(on: &_container, forKey: .targetDisease) + try vaccineCode?.encode(on: &_container, forKey: .vaccineCode) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImmunizationRecommendationRecommendation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return date == _other.date + && dateCriterion == _other.dateCriterion + && doseNumber == _other.doseNumber + && forecastStatus == _other.forecastStatus + && `protocol` == _other.`protocol` + && supportingImmunization == _other.supportingImmunization + && supportingPatientInformation == _other.supportingPatientInformation + && targetDisease == _other.targetDisease + && vaccineCode == _other.vaccineCode + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(date) + hasher.combine(dateCriterion) + hasher.combine(doseNumber) + hasher.combine(forecastStatus) + hasher.combine(`protocol`) + hasher.combine(supportingImmunization) + hasher.combine(supportingPatientInformation) + hasher.combine(targetDisease) + hasher.combine(vaccineCode) + } +} + +/** + Dates governing proposed immunization. + + Vaccine date recommendations. For example, earliest date to administer, latest date to administer, etc. + */ +open class ImmunizationRecommendationRecommendationDateCriterion: BackboneElement { + + /// Type of date + public var code: CodeableConcept + + /// Recommended date + public var value: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(code: CodeableConcept, value: FHIRPrimitive) { + self.code = code + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + value: FHIRPrimitive) + { + self.init(code: code, value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKey: .code) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImmunizationRecommendationRecommendationDateCriterion else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(value) + } +} + +/** + Protocol used by recommendation. + + Contains information about the protocol under which the vaccine was administered. + */ +open class ImmunizationRecommendationRecommendationProtocol: BackboneElement { + + /// Dose number within sequence + public var doseSequence: FHIRPrimitive? + + /// Protocol details + public var description_fhir: FHIRPrimitive? + + /// Who is responsible for protocol + public var authority: Reference? + + /// Name of vaccination series + public var series: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + authority: Reference? = nil, + description_fhir: FHIRPrimitive? = nil, + doseSequence: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + series: FHIRPrimitive? = nil) + { + self.init() + self.authority = authority + self.description_fhir = description_fhir + self.doseSequence = doseSequence + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.series = series + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authority + case description_fhir = "description"; case _description_fhir = "_description" + case doseSequence; case _doseSequence + case series; case _series + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.authority = try Reference(from: _container, forKeyIfPresent: .authority) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.doseSequence = try FHIRPrimitive(from: _container, forKeyIfPresent: .doseSequence, auxiliaryKey: ._doseSequence) + self.series = try FHIRPrimitive(from: _container, forKeyIfPresent: .series, auxiliaryKey: ._series) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authority?.encode(on: &_container, forKey: .authority) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try doseSequence?.encode(on: &_container, forKey: .doseSequence, auxiliaryKey: ._doseSequence) + try series?.encode(on: &_container, forKey: .series, auxiliaryKey: ._series) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImmunizationRecommendationRecommendationProtocol else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authority == _other.authority + && description_fhir == _other.description_fhir + && doseSequence == _other.doseSequence + && series == _other.series + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authority) + hasher.combine(description_fhir) + hasher.combine(doseSequence) + hasher.combine(series) + } +} diff --git a/Sources/ModelsSTU3/ImplementationGuide.swift b/Sources/ModelsSTU3/ImplementationGuide.swift new file mode 100644 index 0000000..c50268e --- /dev/null +++ b/Sources/ModelsSTU3/ImplementationGuide.swift @@ -0,0 +1,815 @@ +// +// ImplementationGuide.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A set of rules about how FHIR is used. + + A set of rules of how FHIR is used to solve a particular problem. This resource is used to gather all the parts of an + implementation guide into a logical whole and to publish a computable definition of all the parts. + */ +open class ImplementationGuide: DomainResource { + + override open class var resourceType: ResourceType { return .implementationGuide } + + /// Logical URI to reference this implementation guide (globally unique) + public var url: FHIRPrimitive + + /// Business version of the implementation guide + public var version: FHIRPrimitive? + + /// Name for this implementation guide (computer friendly) + public var name: FHIRPrimitive + + /// The status of this implementation guide. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the implementation guide + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for implementation guide (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// FHIR Version this Implementation Guide targets + public var fhirVersion: FHIRPrimitive? + + /// Another Implementation guide this depends on + public var dependency: [ImplementationGuideDependency]? + + /// Group of resources as used in .page.package + public var package: [ImplementationGuidePackage]? + + /// Profiles that apply globally + public var global: [ImplementationGuideGlobal]? + + /// Image, css, script, etc. + public var binary: [FHIRPrimitive]? + + /// Page/Section in the Guide + public var page: ImplementationGuidePage? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive, status: FHIRPrimitive, url: FHIRPrimitive) { + self.name = name + self.status = status + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + binary: [FHIRPrimitive]? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + dependency: [ImplementationGuideDependency]? = nil, + description_fhir: FHIRPrimitive? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + fhirVersion: FHIRPrimitive? = nil, + global: [ImplementationGuideGlobal]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + package: [ImplementationGuidePackage]? = nil, + page: ImplementationGuidePage? = nil, + publisher: FHIRPrimitive? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + url: FHIRPrimitive, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(name: name, status: status, url: url) + self.binary = binary + self.contact = contact + self.contained = contained + self.copyright = copyright + self.date = date + self.dependency = dependency + self.description_fhir = description_fhir + self.experimental = experimental + self.`extension` = `extension` + self.fhirVersion = fhirVersion + self.global = global + self.id = id + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.package = package + self.page = page + self.publisher = publisher + self.text = text + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case binary; case _binary + case contact + case copyright; case _copyright + case date; case _date + case dependency + case description_fhir = "description"; case _description_fhir = "_description" + case experimental; case _experimental + case fhirVersion; case _fhirVersion + case global + case jurisdiction + case name; case _name + case package + case page + case publisher; case _publisher + case status; case _status + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.binary = try [FHIRPrimitive](from: _container, forKeyIfPresent: .binary, auxiliaryKey: ._binary) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.dependency = try [ImplementationGuideDependency](from: _container, forKeyIfPresent: .dependency) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.fhirVersion = try FHIRPrimitive(from: _container, forKeyIfPresent: .fhirVersion, auxiliaryKey: ._fhirVersion) + self.global = try [ImplementationGuideGlobal](from: _container, forKeyIfPresent: .global) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.package = try [ImplementationGuidePackage](from: _container, forKeyIfPresent: .package) + self.page = try ImplementationGuidePage(from: _container, forKeyIfPresent: .page) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try binary?.encode(on: &_container, forKey: .binary, auxiliaryKey: ._binary) + try contact?.encode(on: &_container, forKey: .contact) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try dependency?.encode(on: &_container, forKey: .dependency) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try fhirVersion?.encode(on: &_container, forKey: .fhirVersion, auxiliaryKey: ._fhirVersion) + try global?.encode(on: &_container, forKey: .global) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try package?.encode(on: &_container, forKey: .package) + try page?.encode(on: &_container, forKey: .page) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImplementationGuide else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return binary == _other.binary + && contact == _other.contact + && copyright == _other.copyright + && date == _other.date + && dependency == _other.dependency + && description_fhir == _other.description_fhir + && experimental == _other.experimental + && fhirVersion == _other.fhirVersion + && global == _other.global + && jurisdiction == _other.jurisdiction + && name == _other.name + && package == _other.package + && page == _other.page + && publisher == _other.publisher + && status == _other.status + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(binary) + hasher.combine(contact) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(dependency) + hasher.combine(description_fhir) + hasher.combine(experimental) + hasher.combine(fhirVersion) + hasher.combine(global) + hasher.combine(jurisdiction) + hasher.combine(name) + hasher.combine(package) + hasher.combine(page) + hasher.combine(publisher) + hasher.combine(status) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Another Implementation guide this depends on. + + Another implementation guide that this implementation depends on. Typically, an implementation guide uses value sets, + profiles etc.defined in other implementation guides. + */ +open class ImplementationGuideDependency: BackboneElement { + + /// How the dependency is represented when the guide is published. + public var type: FHIRPrimitive + + /// Where to find dependency + public var uri: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive, uri: FHIRPrimitive) { + self.type = type + self.uri = uri + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: FHIRPrimitive, + uri: FHIRPrimitive) + { + self.init(type: type, uri: uri) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case type; case _type + case uri; case _uri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.uri = try FHIRPrimitive(from: _container, forKey: .uri, auxiliaryKey: ._uri) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try uri.encode(on: &_container, forKey: .uri, auxiliaryKey: ._uri) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImplementationGuideDependency else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return type == _other.type + && uri == _other.uri + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(type) + hasher.combine(uri) + } +} + +/** + Profiles that apply globally. + + A set of profiles that all resources covered by this implementation guide must conform to. + */ +open class ImplementationGuideGlobal: BackboneElement { + + /// The type of resource that all instances must conform to. + public var type: FHIRPrimitive + + /// Profile that all resources must conform to + public var profile: Reference + + /// Designated initializer taking all required properties + public init(profile: Reference, type: FHIRPrimitive) { + self.profile = profile + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + profile: Reference, + type: FHIRPrimitive) + { + self.init(profile: profile, type: type) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case profile + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.profile = try Reference(from: _container, forKey: .profile) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try profile.encode(on: &_container, forKey: .profile) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImplementationGuideGlobal else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return profile == _other.profile + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(profile) + hasher.combine(type) + } +} + +/** + Group of resources as used in .page.package. + + A logical group of resources. Logical groups can be used when building pages. + */ +open class ImplementationGuidePackage: BackboneElement { + + /// Name used .page.package + public var name: FHIRPrimitive + + /// Human readable text describing the package + public var description_fhir: FHIRPrimitive? + + /// Resource in the implementation guide + public var resource: [ImplementationGuidePackageResource] + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive, resource: [ImplementationGuidePackageResource]) { + self.name = name + self.resource = resource + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + resource: [ImplementationGuidePackageResource]) + { + self.init(name: name, resource: resource) + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case name; case _name + case resource + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.resource = try [ImplementationGuidePackageResource](from: _container, forKey: .resource) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try resource.encode(on: &_container, forKey: .resource) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImplementationGuidePackage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && name == _other.name + && resource == _other.resource + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(name) + hasher.combine(resource) + } +} + +/** + Resource in the implementation guide. + + A resource that is part of the implementation guide. Conformance resources (value set, structure definition, capability + statements etc.) are obvious candidates for inclusion, but any kind of resource can be included as an example resource. + */ +open class ImplementationGuidePackageResource: BackboneElement { + + /// All possible types for "source[x]" + public enum SourceX: Hashable { + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// If not an example, has its normal meaning + public var example: FHIRPrimitive + + /// Human Name for the resource + public var name: FHIRPrimitive? + + /// Reason why included in guide + public var description_fhir: FHIRPrimitive? + + /// Short code to identify the resource + public var acronym: FHIRPrimitive? + + /// Location of the resource + /// One of `source[x]` + public var source: SourceX + + /// Resource this is an example of (if applicable) + public var exampleFor: Reference? + + /// Designated initializer taking all required properties + public init(example: FHIRPrimitive, source: SourceX) { + self.example = example + self.source = source + super.init() + } + + /// Convenience initializer + public convenience init( + acronym: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + example: FHIRPrimitive, + exampleFor: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + source: SourceX) + { + self.init(example: example, source: source) + self.acronym = acronym + self.description_fhir = description_fhir + self.exampleFor = exampleFor + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.name = name + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case acronym; case _acronym + case description_fhir = "description"; case _description_fhir = "_description" + case example; case _example + case exampleFor + case name; case _name + case sourceReference + case sourceUri; case _sourceUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.sourceReference) || _container.contains(CodingKeys.sourceUri) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.sourceReference, CodingKeys.sourceUri], debugDescription: "Must have at least one value for \"source\" but have none")) + } + + // Decode all our properties + self.acronym = try FHIRPrimitive(from: _container, forKeyIfPresent: .acronym, auxiliaryKey: ._acronym) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.example = try FHIRPrimitive(from: _container, forKey: .example, auxiliaryKey: ._example) + self.exampleFor = try Reference(from: _container, forKeyIfPresent: .exampleFor) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + var _t_source: SourceX? = nil + if let sourceUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .sourceUri, auxiliaryKey: ._sourceUri) { + if _t_source != nil { + throw DecodingError.dataCorruptedError(forKey: .sourceUri, in: _container, debugDescription: "More than one value provided for \"source\"") + } + _t_source = .uri(sourceUri) + } + if let sourceReference = try Reference(from: _container, forKeyIfPresent: .sourceReference) { + if _t_source != nil { + throw DecodingError.dataCorruptedError(forKey: .sourceReference, in: _container, debugDescription: "More than one value provided for \"source\"") + } + _t_source = .reference(sourceReference) + } + self.source = _t_source! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try acronym?.encode(on: &_container, forKey: .acronym, auxiliaryKey: ._acronym) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try example.encode(on: &_container, forKey: .example, auxiliaryKey: ._example) + try exampleFor?.encode(on: &_container, forKey: .exampleFor) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + + switch source { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .sourceUri, auxiliaryKey: ._sourceUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .sourceReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImplementationGuidePackageResource else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return acronym == _other.acronym + && description_fhir == _other.description_fhir + && example == _other.example + && exampleFor == _other.exampleFor + && name == _other.name + && source == _other.source + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(acronym) + hasher.combine(description_fhir) + hasher.combine(example) + hasher.combine(exampleFor) + hasher.combine(name) + hasher.combine(source) + } +} + +/** + Page/Section in the Guide. + + A page / section in the implementation guide. The root page is the implementation guide home page. + */ +open class ImplementationGuidePage: BackboneElement { + + /// Where to find that page + public var source: FHIRPrimitive + + /// Short title shown for navigational assistance + public var title: FHIRPrimitive + + /// The kind of page that this is. Some pages are autogenerated (list, example), and other kinds are of interest so + /// that tools can navigate the user to the page of interest. + public var kind: FHIRPrimitive + + /// For constructed pages, what kind of resources to include in the list. + public var type: [FHIRPrimitive]? + + /// Name of package to include + public var package: [FHIRPrimitive]? + + /// Format of the page (e.g. html, markdown, etc.) + public var format: FHIRPrimitive? + + /// Nested Pages / Sections + public var page: [ImplementationGuidePage]? + + /// Designated initializer taking all required properties + public init(kind: FHIRPrimitive, source: FHIRPrimitive, title: FHIRPrimitive) { + self.kind = kind + self.source = source + self.title = title + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + format: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + kind: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + package: [FHIRPrimitive]? = nil, + page: [ImplementationGuidePage]? = nil, + source: FHIRPrimitive, + title: FHIRPrimitive, + type: [FHIRPrimitive]? = nil) + { + self.init(kind: kind, source: source, title: title) + self.`extension` = `extension` + self.format = format + self.id = id + self.modifierExtension = modifierExtension + self.package = package + self.page = page + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case format; case _format + case kind; case _kind + case package; case _package + case page + case source; case _source + case title; case _title + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.format = try FHIRPrimitive(from: _container, forKeyIfPresent: .format, auxiliaryKey: ._format) + self.kind = try FHIRPrimitive(from: _container, forKey: .kind, auxiliaryKey: ._kind) + self.package = try [FHIRPrimitive](from: _container, forKeyIfPresent: .package, auxiliaryKey: ._package) + self.page = try [ImplementationGuidePage](from: _container, forKeyIfPresent: .page) + self.source = try FHIRPrimitive(from: _container, forKey: .source, auxiliaryKey: ._source) + self.title = try FHIRPrimitive(from: _container, forKey: .title, auxiliaryKey: ._title) + self.type = try [FHIRPrimitive](from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try format?.encode(on: &_container, forKey: .format, auxiliaryKey: ._format) + try kind.encode(on: &_container, forKey: .kind, auxiliaryKey: ._kind) + try package?.encode(on: &_container, forKey: .package, auxiliaryKey: ._package) + try page?.encode(on: &_container, forKey: .page) + try source.encode(on: &_container, forKey: .source, auxiliaryKey: ._source) + try title.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ImplementationGuidePage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return format == _other.format + && kind == _other.kind + && package == _other.package + && page == _other.page + && source == _other.source + && title == _other.title + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(format) + hasher.combine(kind) + hasher.combine(package) + hasher.combine(page) + hasher.combine(source) + hasher.combine(title) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/Instant.swift b/Sources/ModelsSTU3/Instant.swift new file mode 100644 index 0000000..074804c --- /dev/null +++ b/Sources/ModelsSTU3/Instant.swift @@ -0,0 +1,171 @@ +// +// Instant.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import FMCore + +/** + An instant in time in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz (e.g. 2015-02-07T13:28:17.239+02:00 or + 2017-01-01T00:00:00Z). The time SHALL specified at least to the second and SHALL include a time zone. + + - Note: This is intended for when precisely observed times are required (typically system logs etc.), and not + human-reported times - for those, use date or dateTime (which can be as precise as instant, but is not required to be). + Instant is a more constrained dateTime. + + http://hl7.org/fhir/datatypes.html#instant + */ +public struct Instant: FHIRPrimitiveType { + + private var _timezoneIsUnaltered = true + + public var date: InstantDate + + public var time: FHIRTime + + public var timeZone: TimeZone { + didSet { + _timezoneIsUnaltered = false + } + } + + public let originalTimeZoneString: String? + + /** + * Designated initializer. + */ + public init(date: InstantDate, time: FHIRTime, timezone: TimeZone) { + self.init(date: date, time: time, timezone: timezone, originalTimeZoneString: nil) + } + + public init(_ originalString: String) throws { + let scanner = Scanner(string: originalString) + let (date, time, timezone, timeZoneString) = try Instant.parse(from: scanner) + self.init(date: date, time: time, timezone: timezone, originalTimeZoneString: timeZoneString) + } + + private init(date: InstantDate, time: FHIRTime, timezone: TimeZone, originalTimeZoneString: String? = nil) { + self.date = date + self.time = time + self.timeZone = timezone + self.originalTimeZoneString = originalTimeZoneString + } + + // MARK: Parsing + + /// Parse valid "instant" strings. + public static func parse(from scanner: Scanner, expectAtEnd: Bool = true) throws -> (date: InstantDate, time: FHIRTime, timezone: TimeZone, timeZoneString: String) { + let originalCharactersToBeSkipped = scanner.charactersToBeSkipped + defer { scanner.charactersToBeSkipped = originalCharactersToBeSkipped } + scanner.charactersToBeSkipped = nil + + // Date, Time & TimeZone + let date = try InstantDate.parse(from: scanner, expectAtEnd: false) + guard scanner.scanString("T", into: nil) else { + throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.scanLocation)) + } + + let scanLocation = scanner.scanLocation + let time = try FHIRTime.parse(from: scanner, expectAtEnd: false) + let (secondsFromGMT, timeZoneString) = try TimeZone.hs_parseComponents(from: scanner, expectAtEnd: true) + guard let timeZone = TimeZone(secondsFromGMT: secondsFromGMT) else { // we should never hit this since `TimeZone.hs_parseComponents` takes care of validation + throw FHIRDateParserError.invalidTimeZoneHour(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + // Done + if expectAtEnd && !scanner.isAtEnd { // it's OK if we don't `expectAtEnd` but the scanner actually is + throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanner.scanLocation)) + } + + return (date, time, timeZone, timeZoneString) + } +} + +// MARK: - + +extension Instant: ExpressibleByStringLiteral { + + public init(stringLiteral value: StringLiteralType) { + try! self.init(value) + } +} + +extension Instant: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + let string = try container.decode(String.self) + try self.init(string) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(description) + } +} + +extension Instant: CustomStringConvertible { + + public var description: String { + if _timezoneIsUnaltered, let originalTimeZoneString = originalTimeZoneString { + return String(format: "%@T%@%@", date.description, time.description, originalTimeZoneString) + } + return String(format: "%@T%@%@", date.description, time.description, timeZone.fhirDescription) + } +} + +extension Instant: Equatable { + + public static func ==(l: Instant, r: Instant) -> Bool { + if l.date != r.date { + return false + } + if l.time != r.time { + return false + } + if l.timeZone != r.timeZone { + return false + } + return true + } + + public static func ==(l: Instant, r: DateTime) -> Bool { + if !(l.date == r.date) { + return false + } + if l.time != r.time { + return false + } + if l.timeZone != r.timeZone { + return false + } + return true + } + + public static func ==(l: DateTime, r: Instant) -> Bool { + if !(l.date == r.date) { + return false + } + if l.time != r.time { + return false + } + if l.timeZone != r.timeZone { + return false + } + return true + } +} diff --git a/Sources/ModelsSTU3/InstantDate.swift b/Sources/ModelsSTU3/InstantDate.swift new file mode 100644 index 0000000..fa8bf46 --- /dev/null +++ b/Sources/ModelsSTU3/InstantDate.swift @@ -0,0 +1,188 @@ +// +// InstantDate.swift +// HealthSoftware +// +// 2020, Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import FMCore + +/** + A stricter version of `FHIRDate` which requires month and day to be present, for use in `Instant`. + + http://hl7.org/fhir/datatypes.html#date + */ +public struct InstantDate: FHIRPrimitiveType { + + public var year: Int + + public var month: UInt8 { + didSet { + if month > 12 { + month = oldValue + } + } + } + + public var day: UInt8 { + didSet { + if day > 31 { + day = oldValue + } + } + } + + /** + Designated initializer. Day is capped at 31, month is capped at 12. + */ + public init(year: Int, month: UInt8, day: UInt8) { + self.year = year + self.month = min(month, 12) + self.day = min(day, 31) + } + + public init(_ originalString: String) throws { + let scanner = Scanner(string: originalString) + let (year, month, day) = try InstantDate.parseComponents(from: scanner) + self.init(year: year, month: month, day: day) + } + + // MARK: Parsing + + /// Parse valid "date" strings but require month and day to be present + /// See http://hl7.org/fhir/datatypes.html#date + public static func parseComponents(from scanner: Scanner, expectAtEnd: Bool = true) throws -> (year: Int, month: UInt8, day: UInt8) { + let originalCharactersToBeSkipped = scanner.charactersToBeSkipped + defer { scanner.charactersToBeSkipped = originalCharactersToBeSkipped } + scanner.charactersToBeSkipped = nil + let numbers = CharacterSet.decimalDigits + + // Year + var scanLocation = scanner.scanLocation + guard let scanned = scanner.hs_scanCharacters(from: numbers), scanned.count == 4, let year = Int(scanned), year > 0 else { + throw FHIRDateParserError.invalidYear(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + // Month + guard scanner.scanString("-", into: nil) else { + throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.scanLocation)) + } + scanLocation = scanner.scanLocation + guard let scannedMonth = scanner.hs_scanCharacters(from: numbers), scannedMonth.count == 2, let month = UInt8(scannedMonth), (1...12).contains(month) else { + throw FHIRDateParserError.invalidMonth(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + // Day + guard scanner.scanString("-", into: nil) else { + throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.scanLocation)) + } + scanLocation = scanner.scanLocation + guard let scannedDay = scanner.hs_scanCharacters(from: numbers), scannedDay.count == 2, let day = UInt8(scannedDay), (1...31).contains(day) else { + throw FHIRDateParserError.invalidDay(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + // Finish + scanLocation = scanner.scanLocation + if expectAtEnd && !scanner.isAtEnd { // it's OK if we don't `expectAtEnd` but the scanner actually is + throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanLocation)) + } + + return (year, month, day) + } + + public static func parse(from scanner: Scanner, expectAtEnd: Bool = true) throws -> InstantDate { + let (year, month, day) = try InstantDate.parseComponents(from: scanner, expectAtEnd: expectAtEnd) + return self.init(year: year, month: month, day: day) + } +} + +// MARK: - + +extension InstantDate: ExpressibleByStringLiteral { + + public init(stringLiteral value: StringLiteralType) { + try! self.init(value) + } +} + +extension InstantDate: Codable { + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + let string = try container.decode(String.self) + try self.init(string) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(description) + } +} + +extension InstantDate: CustomStringConvertible { + + public var description: String { + return String(format: "%04d-%02d-%02d", year, month, day) + } +} + +extension InstantDate: Equatable { + + public static func ==(l: InstantDate, r: InstantDate) -> Bool { + if l.year != r.year { + return false + } + if l.month != r.month { + return false + } + if l.day != r.day { + return false + } + return true + } + + public static func ==(l: InstantDate, r: FHIRDate) -> Bool { + if l.year != r.year { + return false + } + if l.month != r.month { + return false + } + if l.day != r.day { + return false + } + return true + } + + public static func ==(l: FHIRDate, r: InstantDate) -> Bool { + if l.year != r.year { + return false + } + if l.month != r.month { + return false + } + if l.day != r.day { + return false + } + return true + } +} + +extension InstantDate { + + public var fhirDate: FHIRDate { + return FHIRDate(year: year, month: month, day: day) + } +} diff --git a/Sources/ModelsSTU3/Library.swift b/Sources/ModelsSTU3/Library.swift new file mode 100644 index 0000000..adef723 --- /dev/null +++ b/Sources/ModelsSTU3/Library.swift @@ -0,0 +1,355 @@ +// +// Library.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Library) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Represents a library of quality improvement components. + + The Library resource is a general-purpose container for knowledge asset definitions. It can be used to describe and + expose existing knowledge assets such as logic libraries and information model descriptions, as well as to describe a + collection of knowledge assets. + */ +open class Library: DomainResource { + + override open class var resourceType: ResourceType { return .library } + + /// Logical URI to reference this library (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the library + public var identifier: [Identifier]? + + /// Business version of the library + public var version: FHIRPrimitive? + + /// Name for this library (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this library (human friendly) + public var title: FHIRPrimitive? + + /// The status of this library. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// logic-library | model-definition | asset-collection | module-definition + public var type: CodeableConcept + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Natural language description of the library + public var description_fhir: FHIRPrimitive? + + /// Why this library is defined + public var purpose: FHIRPrimitive? + + /// Describes the clinical usage of the library + public var usage: FHIRPrimitive? + + /// When the library was approved by publisher + public var approvalDate: FHIRPrimitive? + + /// When the library was last reviewed + public var lastReviewDate: FHIRPrimitive? + + /// When the library is expected to be used + public var effectivePeriod: Period? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for library (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// E.g. Education, Treatment, Assessment, etc + public var topic: [CodeableConcept]? + + /// A content contributor + public var contributor: [Contributor]? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Additional documentation, citations, etc. + public var relatedArtifact: [RelatedArtifact]? + + /// Parameters defined by the library + public var parameter: [ParameterDefinition]? + + /// What data is referenced by this library + public var dataRequirement: [DataRequirement]? + + /// Contents of the library, either embedded or referenced + public var content: [Attachment]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive, type: CodeableConcept) { + self.status = status + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + approvalDate: FHIRPrimitive? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + content: [Attachment]? = nil, + contributor: [Contributor]? = nil, + copyright: FHIRPrimitive? = nil, + dataRequirement: [DataRequirement]? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + effectivePeriod: Period? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + lastReviewDate: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + parameter: [ParameterDefinition]? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + relatedArtifact: [RelatedArtifact]? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + topic: [CodeableConcept]? = nil, + type: CodeableConcept, + url: FHIRPrimitive? = nil, + usage: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(status: status, type: type) + self.approvalDate = approvalDate + self.contact = contact + self.contained = contained + self.content = content + self.contributor = contributor + self.copyright = copyright + self.dataRequirement = dataRequirement + self.date = date + self.description_fhir = description_fhir + self.effectivePeriod = effectivePeriod + self.experimental = experimental + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.lastReviewDate = lastReviewDate + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.parameter = parameter + self.publisher = publisher + self.purpose = purpose + self.relatedArtifact = relatedArtifact + self.text = text + self.title = title + self.topic = topic + self.url = url + self.usage = usage + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case approvalDate; case _approvalDate + case contact + case content + case contributor + case copyright; case _copyright + case dataRequirement + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case effectivePeriod + case experimental; case _experimental + case identifier + case jurisdiction + case lastReviewDate; case _lastReviewDate + case name; case _name + case parameter + case publisher; case _publisher + case purpose; case _purpose + case relatedArtifact + case status; case _status + case title; case _title + case topic + case type + case url; case _url + case usage; case _usage + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.approvalDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .approvalDate, auxiliaryKey: ._approvalDate) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.content = try [Attachment](from: _container, forKeyIfPresent: .content) + self.contributor = try [Contributor](from: _container, forKeyIfPresent: .contributor) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.dataRequirement = try [DataRequirement](from: _container, forKeyIfPresent: .dataRequirement) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.lastReviewDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.parameter = try [ParameterDefinition](from: _container, forKeyIfPresent: .parameter) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.relatedArtifact = try [RelatedArtifact](from: _container, forKeyIfPresent: .relatedArtifact) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.topic = try [CodeableConcept](from: _container, forKeyIfPresent: .topic) + self.type = try CodeableConcept(from: _container, forKey: .type) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.usage = try FHIRPrimitive(from: _container, forKeyIfPresent: .usage, auxiliaryKey: ._usage) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try approvalDate?.encode(on: &_container, forKey: .approvalDate, auxiliaryKey: ._approvalDate) + try contact?.encode(on: &_container, forKey: .contact) + try content?.encode(on: &_container, forKey: .content) + try contributor?.encode(on: &_container, forKey: .contributor) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try dataRequirement?.encode(on: &_container, forKey: .dataRequirement) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try effectivePeriod?.encode(on: &_container, forKey: .effectivePeriod) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try lastReviewDate?.encode(on: &_container, forKey: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try parameter?.encode(on: &_container, forKey: .parameter) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try relatedArtifact?.encode(on: &_container, forKey: .relatedArtifact) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try topic?.encode(on: &_container, forKey: .topic) + try type.encode(on: &_container, forKey: .type) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try usage?.encode(on: &_container, forKey: .usage, auxiliaryKey: ._usage) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Library else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return approvalDate == _other.approvalDate + && contact == _other.contact + && content == _other.content + && contributor == _other.contributor + && copyright == _other.copyright + && dataRequirement == _other.dataRequirement + && date == _other.date + && description_fhir == _other.description_fhir + && effectivePeriod == _other.effectivePeriod + && experimental == _other.experimental + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && lastReviewDate == _other.lastReviewDate + && name == _other.name + && parameter == _other.parameter + && publisher == _other.publisher + && purpose == _other.purpose + && relatedArtifact == _other.relatedArtifact + && status == _other.status + && title == _other.title + && topic == _other.topic + && type == _other.type + && url == _other.url + && usage == _other.usage + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(approvalDate) + hasher.combine(contact) + hasher.combine(content) + hasher.combine(contributor) + hasher.combine(copyright) + hasher.combine(dataRequirement) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(effectivePeriod) + hasher.combine(experimental) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(lastReviewDate) + hasher.combine(name) + hasher.combine(parameter) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(relatedArtifact) + hasher.combine(status) + hasher.combine(title) + hasher.combine(topic) + hasher.combine(type) + hasher.combine(url) + hasher.combine(usage) + hasher.combine(useContext) + hasher.combine(version) + } +} diff --git a/Sources/ModelsSTU3/Linkage.swift b/Sources/ModelsSTU3/Linkage.swift new file mode 100644 index 0000000..16794e3 --- /dev/null +++ b/Sources/ModelsSTU3/Linkage.swift @@ -0,0 +1,206 @@ +// +// Linkage.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Linkage) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Links records for 'same' item. + + Identifies two or more records (resource instances) that are referring to the same real-world "occurrence". + */ +open class Linkage: DomainResource { + + override open class var resourceType: ResourceType { return .linkage } + + /// Whether this linkage assertion is active or not + public var active: FHIRPrimitive? + + /// Who is responsible for linkages + public var author: Reference? + + /// Item to be linked + public var item: [LinkageItem] + + /// Designated initializer taking all required properties + public init(item: [LinkageItem]) { + self.item = item + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + author: Reference? = nil, + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + item: [LinkageItem], + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + text: Narrative? = nil) + { + self.init(item: item) + self.active = active + self.author = author + self.contained = contained + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case author + case item + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.author = try Reference(from: _container, forKeyIfPresent: .author) + self.item = try [LinkageItem](from: _container, forKey: .item) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try author?.encode(on: &_container, forKey: .author) + try item.encode(on: &_container, forKey: .item) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Linkage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && author == _other.author + && item == _other.item + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(author) + hasher.combine(item) + } +} + +/** + Item to be linked. + + Identifies one of the records that is considered to refer to the same real-world occurrence as well as how the items + hould be evaluated within the collection of linked items. + */ +open class LinkageItem: BackboneElement { + + /// Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current + /// representations. + public var type: FHIRPrimitive + + /// Resource being linked + public var resource: Reference + + /// Designated initializer taking all required properties + public init(resource: Reference, type: FHIRPrimitive) { + self.resource = resource + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + resource: Reference, + type: FHIRPrimitive) + { + self.init(resource: resource, type: type) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case resource + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.resource = try Reference(from: _container, forKey: .resource) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try resource.encode(on: &_container, forKey: .resource) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? LinkageItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return resource == _other.resource + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(resource) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/List.swift b/Sources/ModelsSTU3/List.swift new file mode 100644 index 0000000..f739a70 --- /dev/null +++ b/Sources/ModelsSTU3/List.swift @@ -0,0 +1,326 @@ +// +// List.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/List) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Information summarized from a list of other resources. + + A set of information summarized from a list of other resources. + */ +open class List: DomainResource { + + override open class var resourceType: ResourceType { return .list } + + /// Business identifier + public var identifier: [Identifier]? + + /// Indicates the current state of this list. + public var status: FHIRPrimitive + + /// How this list was prepared - whether it is a working list that is suitable for being maintained on an ongoing + /// basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list + /// where items may be marked as added, modified or deleted. + public var mode: FHIRPrimitive + + /// Descriptive name for the list + public var title: FHIRPrimitive? + + /// What the purpose of this list is + public var code: CodeableConcept? + + /// If all resources have the same subject + public var subject: Reference? + + /// Context in which list created + public var encounter: Reference? + + /// When the list was prepared + public var date: FHIRPrimitive? + + /// Who and/or what defined the list contents (aka Author) + public var source: Reference? + + /// What order the list has + public var orderedBy: CodeableConcept? + + /// Comments about the list + public var note: [Annotation]? + + /// Entries in the list + public var entry: [ListEntry]? + + /// Why list is empty + public var emptyReason: CodeableConcept? + + /// Designated initializer taking all required properties + public init(mode: FHIRPrimitive, status: FHIRPrimitive) { + self.mode = mode + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + emptyReason: CodeableConcept? = nil, + encounter: Reference? = nil, + entry: [ListEntry]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + mode: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + orderedBy: CodeableConcept? = nil, + source: Reference? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil, + title: FHIRPrimitive? = nil) + { + self.init(mode: mode, status: status) + self.code = code + self.contained = contained + self.date = date + self.emptyReason = emptyReason + self.encounter = encounter + self.entry = entry + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.orderedBy = orderedBy + self.source = source + self.subject = subject + self.text = text + self.title = title + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case date; case _date + case emptyReason + case encounter + case entry + case identifier + case mode; case _mode + case note + case orderedBy + case source + case status; case _status + case subject + case title; case _title + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.emptyReason = try CodeableConcept(from: _container, forKeyIfPresent: .emptyReason) + self.encounter = try Reference(from: _container, forKeyIfPresent: .encounter) + self.entry = try [ListEntry](from: _container, forKeyIfPresent: .entry) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.mode = try FHIRPrimitive(from: _container, forKey: .mode, auxiliaryKey: ._mode) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.orderedBy = try CodeableConcept(from: _container, forKeyIfPresent: .orderedBy) + self.source = try Reference(from: _container, forKeyIfPresent: .source) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try emptyReason?.encode(on: &_container, forKey: .emptyReason) + try encounter?.encode(on: &_container, forKey: .encounter) + try entry?.encode(on: &_container, forKey: .entry) + try identifier?.encode(on: &_container, forKey: .identifier) + try mode.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try note?.encode(on: &_container, forKey: .note) + try orderedBy?.encode(on: &_container, forKey: .orderedBy) + try source?.encode(on: &_container, forKey: .source) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? List else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && date == _other.date + && emptyReason == _other.emptyReason + && encounter == _other.encounter + && entry == _other.entry + && identifier == _other.identifier + && mode == _other.mode + && note == _other.note + && orderedBy == _other.orderedBy + && source == _other.source + && status == _other.status + && subject == _other.subject + && title == _other.title + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(date) + hasher.combine(emptyReason) + hasher.combine(encounter) + hasher.combine(entry) + hasher.combine(identifier) + hasher.combine(mode) + hasher.combine(note) + hasher.combine(orderedBy) + hasher.combine(source) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(title) + } +} + +/** + Entries in the list. + + Entries in this list. + */ +open class ListEntry: BackboneElement { + + /// Status/Workflow information about this item + public var flag: CodeableConcept? + + /// If this item is actually marked as deleted + public var deleted: FHIRPrimitive? + + /// When item added to list + public var date: FHIRPrimitive? + + /// Actual entry + public var item: Reference + + /// Designated initializer taking all required properties + public init(item: Reference) { + self.item = item + super.init() + } + + /// Convenience initializer + public convenience init( + date: FHIRPrimitive? = nil, + deleted: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + flag: CodeableConcept? = nil, + id: FHIRPrimitive? = nil, + item: Reference, + modifierExtension: [Extension]? = nil) + { + self.init(item: item) + self.date = date + self.deleted = deleted + self.`extension` = `extension` + self.flag = flag + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case date; case _date + case deleted; case _deleted + case flag + case item + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.deleted = try FHIRPrimitive(from: _container, forKeyIfPresent: .deleted, auxiliaryKey: ._deleted) + self.flag = try CodeableConcept(from: _container, forKeyIfPresent: .flag) + self.item = try Reference(from: _container, forKey: .item) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try deleted?.encode(on: &_container, forKey: .deleted, auxiliaryKey: ._deleted) + try flag?.encode(on: &_container, forKey: .flag) + try item.encode(on: &_container, forKey: .item) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ListEntry else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return date == _other.date + && deleted == _other.deleted + && flag == _other.flag + && item == _other.item + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(date) + hasher.combine(deleted) + hasher.combine(flag) + hasher.combine(item) + } +} diff --git a/Sources/ModelsSTU3/Location.swift b/Sources/ModelsSTU3/Location.swift new file mode 100644 index 0000000..c2da76b --- /dev/null +++ b/Sources/ModelsSTU3/Location.swift @@ -0,0 +1,338 @@ +// +// Location.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Location) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Details and position information for a physical place. + + Details and position information for a physical place where services are provided and resources and participants may + be stored, found, contained or accommodated. + */ +open class Location: DomainResource { + + override open class var resourceType: ResourceType { return .location } + + /// Unique code or number identifying the location to its users + public var identifier: [Identifier]? + + /// The status property covers the general availability of the resource, not the current value which may be covered + /// by the operationStatus, or by a schedule/slots if they are configured for the location. + public var status: FHIRPrimitive? + + /// The Operational status of the location (typically only for a bed/room) + public var operationalStatus: Coding? + + /// Name of the location as used by humans + public var name: FHIRPrimitive? + + /// A list of alternate names that the location is known as, or was known as in the past + public var alias: [FHIRPrimitive]? + + /// Additional details about the location that could be displayed as further information to identify the location + /// beyond its name + public var description_fhir: FHIRPrimitive? + + /// Indicates whether a resource instance represents a specific location or a class of locations. + public var mode: FHIRPrimitive? + + /// Type of function performed + public var type: CodeableConcept? + + /// Contact details of the location + public var telecom: [ContactPoint]? + + /// Physical location + public var address: Address? + + /// Physical form of the location + public var physicalType: CodeableConcept? + + /// The absolute geographic location + public var position: LocationPosition? + + /// Organization responsible for provisioning and upkeep + public var managingOrganization: Reference? + + /// Another Location this one is physically part of + public var partOf: Reference? + + /// Technical endpoints providing access to services operated for the location + public var endpoint: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + address: Address? = nil, + alias: [FHIRPrimitive]? = nil, + contained: [ResourceProxy]? = nil, + description_fhir: FHIRPrimitive? = nil, + endpoint: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + managingOrganization: Reference? = nil, + meta: Meta? = nil, + mode: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + operationalStatus: Coding? = nil, + partOf: Reference? = nil, + physicalType: CodeableConcept? = nil, + position: LocationPosition? = nil, + status: FHIRPrimitive? = nil, + telecom: [ContactPoint]? = nil, + text: Narrative? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.address = address + self.alias = alias + self.contained = contained + self.description_fhir = description_fhir + self.endpoint = endpoint + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.managingOrganization = managingOrganization + self.meta = meta + self.mode = mode + self.modifierExtension = modifierExtension + self.name = name + self.operationalStatus = operationalStatus + self.partOf = partOf + self.physicalType = physicalType + self.position = position + self.status = status + self.telecom = telecom + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case address + case alias; case _alias + case description_fhir = "description"; case _description_fhir = "_description" + case endpoint + case identifier + case managingOrganization + case mode; case _mode + case name; case _name + case operationalStatus + case partOf + case physicalType + case position + case status; case _status + case telecom + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.address = try Address(from: _container, forKeyIfPresent: .address) + self.alias = try [FHIRPrimitive](from: _container, forKeyIfPresent: .alias, auxiliaryKey: ._alias) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.endpoint = try [Reference](from: _container, forKeyIfPresent: .endpoint) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.managingOrganization = try Reference(from: _container, forKeyIfPresent: .managingOrganization) + self.mode = try FHIRPrimitive(from: _container, forKeyIfPresent: .mode, auxiliaryKey: ._mode) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.operationalStatus = try Coding(from: _container, forKeyIfPresent: .operationalStatus) + self.partOf = try Reference(from: _container, forKeyIfPresent: .partOf) + self.physicalType = try CodeableConcept(from: _container, forKeyIfPresent: .physicalType) + self.position = try LocationPosition(from: _container, forKeyIfPresent: .position) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try address?.encode(on: &_container, forKey: .address) + try alias?.encode(on: &_container, forKey: .alias, auxiliaryKey: ._alias) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try endpoint?.encode(on: &_container, forKey: .endpoint) + try identifier?.encode(on: &_container, forKey: .identifier) + try managingOrganization?.encode(on: &_container, forKey: .managingOrganization) + try mode?.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try operationalStatus?.encode(on: &_container, forKey: .operationalStatus) + try partOf?.encode(on: &_container, forKey: .partOf) + try physicalType?.encode(on: &_container, forKey: .physicalType) + try position?.encode(on: &_container, forKey: .position) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try telecom?.encode(on: &_container, forKey: .telecom) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Location else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return address == _other.address + && alias == _other.alias + && description_fhir == _other.description_fhir + && endpoint == _other.endpoint + && identifier == _other.identifier + && managingOrganization == _other.managingOrganization + && mode == _other.mode + && name == _other.name + && operationalStatus == _other.operationalStatus + && partOf == _other.partOf + && physicalType == _other.physicalType + && position == _other.position + && status == _other.status + && telecom == _other.telecom + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(address) + hasher.combine(alias) + hasher.combine(description_fhir) + hasher.combine(endpoint) + hasher.combine(identifier) + hasher.combine(managingOrganization) + hasher.combine(mode) + hasher.combine(name) + hasher.combine(operationalStatus) + hasher.combine(partOf) + hasher.combine(physicalType) + hasher.combine(position) + hasher.combine(status) + hasher.combine(telecom) + hasher.combine(type) + } +} + +/** + The absolute geographic location. + + The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system + used in KML). + */ +open class LocationPosition: BackboneElement { + + /// Longitude with WGS84 datum + public var longitude: FHIRPrimitive + + /// Latitude with WGS84 datum + public var latitude: FHIRPrimitive + + /// Altitude with WGS84 datum + public var altitude: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(latitude: FHIRPrimitive, longitude: FHIRPrimitive) { + self.latitude = latitude + self.longitude = longitude + super.init() + } + + /// Convenience initializer + public convenience init( + altitude: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + latitude: FHIRPrimitive, + longitude: FHIRPrimitive, + modifierExtension: [Extension]? = nil) + { + self.init(latitude: latitude, longitude: longitude) + self.altitude = altitude + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case altitude; case _altitude + case latitude; case _latitude + case longitude; case _longitude + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.altitude = try FHIRPrimitive(from: _container, forKeyIfPresent: .altitude, auxiliaryKey: ._altitude) + self.latitude = try FHIRPrimitive(from: _container, forKey: .latitude, auxiliaryKey: ._latitude) + self.longitude = try FHIRPrimitive(from: _container, forKey: .longitude, auxiliaryKey: ._longitude) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try altitude?.encode(on: &_container, forKey: .altitude, auxiliaryKey: ._altitude) + try latitude.encode(on: &_container, forKey: .latitude, auxiliaryKey: ._latitude) + try longitude.encode(on: &_container, forKey: .longitude, auxiliaryKey: ._longitude) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? LocationPosition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return altitude == _other.altitude + && latitude == _other.latitude + && longitude == _other.longitude + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(altitude) + hasher.combine(latitude) + hasher.combine(longitude) + } +} diff --git a/Sources/ModelsSTU3/Measure.swift b/Sources/ModelsSTU3/Measure.swift new file mode 100644 index 0000000..4ba6edc --- /dev/null +++ b/Sources/ModelsSTU3/Measure.swift @@ -0,0 +1,880 @@ +// +// Measure.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Measure) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A quality measure definition. + + The Measure resource provides the definition of a quality measure. + */ +open class Measure: DomainResource { + + override open class var resourceType: ResourceType { return .measure } + + /// Logical URI to reference this measure (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the measure + public var identifier: [Identifier]? + + /// Business version of the measure + public var version: FHIRPrimitive? + + /// Name for this measure (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this measure (human friendly) + public var title: FHIRPrimitive? + + /// The status of this measure. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Natural language description of the measure + public var description_fhir: FHIRPrimitive? + + /// Why this measure is defined + public var purpose: FHIRPrimitive? + + /// Describes the clinical usage of the measure + public var usage: FHIRPrimitive? + + /// When the measure was approved by publisher + public var approvalDate: FHIRPrimitive? + + /// When the measure was last reviewed + public var lastReviewDate: FHIRPrimitive? + + /// When the measure is expected to be used + public var effectivePeriod: Period? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for measure (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// E.g. Education, Treatment, Assessment, etc + public var topic: [CodeableConcept]? + + /// A content contributor + public var contributor: [Contributor]? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Additional documentation, citations, etc + public var relatedArtifact: [RelatedArtifact]? + + /// Logic used by the measure + public var library: [Reference]? + + /// Disclaimer for use of the measure or its referenced content + public var disclaimer: FHIRPrimitive? + + /// proportion | ratio | continuous-variable | cohort + public var scoring: CodeableConcept? + + /// opportunity | all-or-nothing | linear | weighted + public var compositeScoring: CodeableConcept? + + /// process | outcome | structure | patient-reported-outcome | composite + public var type: [CodeableConcept]? + + /// How is risk adjustment applied for this measure + public var riskAdjustment: FHIRPrimitive? + + /// How is rate aggregation performed for this measure + public var rateAggregation: FHIRPrimitive? + + /// Why does this measure exist + public var rationale: FHIRPrimitive? + + /// Summary of clinical guidelines + public var clinicalRecommendationStatement: FHIRPrimitive? + + /// Improvement notation for the measure, e.g. higher score indicates better quality + public var improvementNotation: FHIRPrimitive? + + /// Defined terms used in the measure documentation + public var definition: [FHIRPrimitive]? + + /// Additional guidance for implementers + public var guidance: FHIRPrimitive? + + /// The measure set, e.g. Preventive Care and Screening + public var set: FHIRPrimitive? + + /// Population criteria group + public var group: [MeasureGroup]? + + /// What other data should be reported with the measure + public var supplementalData: [MeasureSupplementalData]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + approvalDate: FHIRPrimitive? = nil, + clinicalRecommendationStatement: FHIRPrimitive? = nil, + compositeScoring: CodeableConcept? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + contributor: [Contributor]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + definition: [FHIRPrimitive]? = nil, + description_fhir: FHIRPrimitive? = nil, + disclaimer: FHIRPrimitive? = nil, + effectivePeriod: Period? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + group: [MeasureGroup]? = nil, + guidance: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + improvementNotation: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + lastReviewDate: FHIRPrimitive? = nil, + library: [Reference]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + rateAggregation: FHIRPrimitive? = nil, + rationale: FHIRPrimitive? = nil, + relatedArtifact: [RelatedArtifact]? = nil, + riskAdjustment: FHIRPrimitive? = nil, + scoring: CodeableConcept? = nil, + set: FHIRPrimitive? = nil, + status: FHIRPrimitive, + supplementalData: [MeasureSupplementalData]? = nil, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + topic: [CodeableConcept]? = nil, + type: [CodeableConcept]? = nil, + url: FHIRPrimitive? = nil, + usage: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(status: status) + self.approvalDate = approvalDate + self.clinicalRecommendationStatement = clinicalRecommendationStatement + self.compositeScoring = compositeScoring + self.contact = contact + self.contained = contained + self.contributor = contributor + self.copyright = copyright + self.date = date + self.definition = definition + self.description_fhir = description_fhir + self.disclaimer = disclaimer + self.effectivePeriod = effectivePeriod + self.experimental = experimental + self.`extension` = `extension` + self.group = group + self.guidance = guidance + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.improvementNotation = improvementNotation + self.jurisdiction = jurisdiction + self.language = language + self.lastReviewDate = lastReviewDate + self.library = library + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.publisher = publisher + self.purpose = purpose + self.rateAggregation = rateAggregation + self.rationale = rationale + self.relatedArtifact = relatedArtifact + self.riskAdjustment = riskAdjustment + self.scoring = scoring + self.set = set + self.supplementalData = supplementalData + self.text = text + self.title = title + self.topic = topic + self.type = type + self.url = url + self.usage = usage + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case approvalDate; case _approvalDate + case clinicalRecommendationStatement; case _clinicalRecommendationStatement + case compositeScoring + case contact + case contributor + case copyright; case _copyright + case date; case _date + case definition; case _definition + case description_fhir = "description"; case _description_fhir = "_description" + case disclaimer; case _disclaimer + case effectivePeriod + case experimental; case _experimental + case group + case guidance; case _guidance + case identifier + case improvementNotation; case _improvementNotation + case jurisdiction + case lastReviewDate; case _lastReviewDate + case library + case name; case _name + case publisher; case _publisher + case purpose; case _purpose + case rateAggregation; case _rateAggregation + case rationale; case _rationale + case relatedArtifact + case riskAdjustment; case _riskAdjustment + case scoring + case set; case _set + case status; case _status + case supplementalData + case title; case _title + case topic + case type + case url; case _url + case usage; case _usage + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.approvalDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .approvalDate, auxiliaryKey: ._approvalDate) + self.clinicalRecommendationStatement = try FHIRPrimitive(from: _container, forKeyIfPresent: .clinicalRecommendationStatement, auxiliaryKey: ._clinicalRecommendationStatement) + self.compositeScoring = try CodeableConcept(from: _container, forKeyIfPresent: .compositeScoring) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.contributor = try [Contributor](from: _container, forKeyIfPresent: .contributor) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.definition = try [FHIRPrimitive](from: _container, forKeyIfPresent: .definition, auxiliaryKey: ._definition) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.disclaimer = try FHIRPrimitive(from: _container, forKeyIfPresent: .disclaimer, auxiliaryKey: ._disclaimer) + self.effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.group = try [MeasureGroup](from: _container, forKeyIfPresent: .group) + self.guidance = try FHIRPrimitive(from: _container, forKeyIfPresent: .guidance, auxiliaryKey: ._guidance) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.improvementNotation = try FHIRPrimitive(from: _container, forKeyIfPresent: .improvementNotation, auxiliaryKey: ._improvementNotation) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.lastReviewDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + self.library = try [Reference](from: _container, forKeyIfPresent: .library) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.rateAggregation = try FHIRPrimitive(from: _container, forKeyIfPresent: .rateAggregation, auxiliaryKey: ._rateAggregation) + self.rationale = try FHIRPrimitive(from: _container, forKeyIfPresent: .rationale, auxiliaryKey: ._rationale) + self.relatedArtifact = try [RelatedArtifact](from: _container, forKeyIfPresent: .relatedArtifact) + self.riskAdjustment = try FHIRPrimitive(from: _container, forKeyIfPresent: .riskAdjustment, auxiliaryKey: ._riskAdjustment) + self.scoring = try CodeableConcept(from: _container, forKeyIfPresent: .scoring) + self.set = try FHIRPrimitive(from: _container, forKeyIfPresent: .set, auxiliaryKey: ._set) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.supplementalData = try [MeasureSupplementalData](from: _container, forKeyIfPresent: .supplementalData) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.topic = try [CodeableConcept](from: _container, forKeyIfPresent: .topic) + self.type = try [CodeableConcept](from: _container, forKeyIfPresent: .type) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.usage = try FHIRPrimitive(from: _container, forKeyIfPresent: .usage, auxiliaryKey: ._usage) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try approvalDate?.encode(on: &_container, forKey: .approvalDate, auxiliaryKey: ._approvalDate) + try clinicalRecommendationStatement?.encode(on: &_container, forKey: .clinicalRecommendationStatement, auxiliaryKey: ._clinicalRecommendationStatement) + try compositeScoring?.encode(on: &_container, forKey: .compositeScoring) + try contact?.encode(on: &_container, forKey: .contact) + try contributor?.encode(on: &_container, forKey: .contributor) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try definition?.encode(on: &_container, forKey: .definition, auxiliaryKey: ._definition) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try disclaimer?.encode(on: &_container, forKey: .disclaimer, auxiliaryKey: ._disclaimer) + try effectivePeriod?.encode(on: &_container, forKey: .effectivePeriod) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try group?.encode(on: &_container, forKey: .group) + try guidance?.encode(on: &_container, forKey: .guidance, auxiliaryKey: ._guidance) + try identifier?.encode(on: &_container, forKey: .identifier) + try improvementNotation?.encode(on: &_container, forKey: .improvementNotation, auxiliaryKey: ._improvementNotation) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try lastReviewDate?.encode(on: &_container, forKey: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + try library?.encode(on: &_container, forKey: .library) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try rateAggregation?.encode(on: &_container, forKey: .rateAggregation, auxiliaryKey: ._rateAggregation) + try rationale?.encode(on: &_container, forKey: .rationale, auxiliaryKey: ._rationale) + try relatedArtifact?.encode(on: &_container, forKey: .relatedArtifact) + try riskAdjustment?.encode(on: &_container, forKey: .riskAdjustment, auxiliaryKey: ._riskAdjustment) + try scoring?.encode(on: &_container, forKey: .scoring) + try set?.encode(on: &_container, forKey: .set, auxiliaryKey: ._set) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try supplementalData?.encode(on: &_container, forKey: .supplementalData) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try topic?.encode(on: &_container, forKey: .topic) + try type?.encode(on: &_container, forKey: .type) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try usage?.encode(on: &_container, forKey: .usage, auxiliaryKey: ._usage) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Measure else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return approvalDate == _other.approvalDate + && clinicalRecommendationStatement == _other.clinicalRecommendationStatement + && compositeScoring == _other.compositeScoring + && contact == _other.contact + && contributor == _other.contributor + && copyright == _other.copyright + && date == _other.date + && definition == _other.definition + && description_fhir == _other.description_fhir + && disclaimer == _other.disclaimer + && effectivePeriod == _other.effectivePeriod + && experimental == _other.experimental + && group == _other.group + && guidance == _other.guidance + && identifier == _other.identifier + && improvementNotation == _other.improvementNotation + && jurisdiction == _other.jurisdiction + && lastReviewDate == _other.lastReviewDate + && library == _other.library + && name == _other.name + && publisher == _other.publisher + && purpose == _other.purpose + && rateAggregation == _other.rateAggregation + && rationale == _other.rationale + && relatedArtifact == _other.relatedArtifact + && riskAdjustment == _other.riskAdjustment + && scoring == _other.scoring + && set == _other.set + && status == _other.status + && supplementalData == _other.supplementalData + && title == _other.title + && topic == _other.topic + && type == _other.type + && url == _other.url + && usage == _other.usage + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(approvalDate) + hasher.combine(clinicalRecommendationStatement) + hasher.combine(compositeScoring) + hasher.combine(contact) + hasher.combine(contributor) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(definition) + hasher.combine(description_fhir) + hasher.combine(disclaimer) + hasher.combine(effectivePeriod) + hasher.combine(experimental) + hasher.combine(group) + hasher.combine(guidance) + hasher.combine(identifier) + hasher.combine(improvementNotation) + hasher.combine(jurisdiction) + hasher.combine(lastReviewDate) + hasher.combine(library) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(rateAggregation) + hasher.combine(rationale) + hasher.combine(relatedArtifact) + hasher.combine(riskAdjustment) + hasher.combine(scoring) + hasher.combine(set) + hasher.combine(status) + hasher.combine(supplementalData) + hasher.combine(title) + hasher.combine(topic) + hasher.combine(type) + hasher.combine(url) + hasher.combine(usage) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Population criteria group. + + A group of population criteria for the measure. + */ +open class MeasureGroup: BackboneElement { + + /// Unique identifier + public var identifier: Identifier + + /// Short name + public var name: FHIRPrimitive? + + /// Summary description + public var description_fhir: FHIRPrimitive? + + /// Population criteria + public var population: [MeasureGroupPopulation]? + + /// Stratifier criteria for the measure + public var stratifier: [MeasureGroupStratifier]? + + /// Designated initializer taking all required properties + public init(identifier: Identifier) { + self.identifier = identifier + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + population: [MeasureGroupPopulation]? = nil, + stratifier: [MeasureGroupStratifier]? = nil) + { + self.init(identifier: identifier) + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.name = name + self.population = population + self.stratifier = stratifier + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case identifier + case name; case _name + case population + case stratifier + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.identifier = try Identifier(from: _container, forKey: .identifier) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.population = try [MeasureGroupPopulation](from: _container, forKeyIfPresent: .population) + self.stratifier = try [MeasureGroupStratifier](from: _container, forKeyIfPresent: .stratifier) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try identifier.encode(on: &_container, forKey: .identifier) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try population?.encode(on: &_container, forKey: .population) + try stratifier?.encode(on: &_container, forKey: .stratifier) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MeasureGroup else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && identifier == _other.identifier + && name == _other.name + && population == _other.population + && stratifier == _other.stratifier + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(identifier) + hasher.combine(name) + hasher.combine(population) + hasher.combine(stratifier) + } +} + +/** + Population criteria. + + A population criteria for the measure. + */ +open class MeasureGroupPopulation: BackboneElement { + + /// Unique identifier + public var identifier: Identifier? + + /// initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator- + /// exception | measure-population | measure-population-exclusion | measure-observation + public var code: CodeableConcept? + + /// Short name + public var name: FHIRPrimitive? + + /// The human readable description of this population criteria + public var description_fhir: FHIRPrimitive? + + /// The name of a valid referenced CQL expression (may be namespaced) that defines this population criteria + public var criteria: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(criteria: FHIRPrimitive) { + self.criteria = criteria + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept? = nil, + criteria: FHIRPrimitive, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil) + { + self.init(criteria: criteria) + self.code = code + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.name = name + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case criteria; case _criteria + case description_fhir = "description"; case _description_fhir = "_description" + case identifier + case name; case _name + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.criteria = try FHIRPrimitive(from: _container, forKey: .criteria, auxiliaryKey: ._criteria) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try criteria.encode(on: &_container, forKey: .criteria, auxiliaryKey: ._criteria) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try identifier?.encode(on: &_container, forKey: .identifier) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MeasureGroupPopulation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && criteria == _other.criteria + && description_fhir == _other.description_fhir + && identifier == _other.identifier + && name == _other.name + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(criteria) + hasher.combine(description_fhir) + hasher.combine(identifier) + hasher.combine(name) + } +} + +/** + Stratifier criteria for the measure. + + The stratifier criteria for the measure report, specified as either the name of a valid CQL expression defined within a + referenced library, or a valid FHIR Resource Path. + */ +open class MeasureGroupStratifier: BackboneElement { + + /// The identifier for the stratifier used to coordinate the reported data back to this stratifier + public var identifier: Identifier? + + /// How the measure should be stratified + public var criteria: FHIRPrimitive? + + /// Path to the stratifier + public var path: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + criteria: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + path: FHIRPrimitive? = nil) + { + self.init() + self.criteria = criteria + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.path = path + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case criteria; case _criteria + case identifier + case path; case _path + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.criteria = try FHIRPrimitive(from: _container, forKeyIfPresent: .criteria, auxiliaryKey: ._criteria) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.path = try FHIRPrimitive(from: _container, forKeyIfPresent: .path, auxiliaryKey: ._path) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try criteria?.encode(on: &_container, forKey: .criteria, auxiliaryKey: ._criteria) + try identifier?.encode(on: &_container, forKey: .identifier) + try path?.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MeasureGroupStratifier else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return criteria == _other.criteria + && identifier == _other.identifier + && path == _other.path + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(criteria) + hasher.combine(identifier) + hasher.combine(path) + } +} + +/** + What other data should be reported with the measure. + + The supplemental data criteria for the measure report, specified as either the name of a valid CQL expression within a + referenced library, or a valid FHIR Resource Path. + */ +open class MeasureSupplementalData: BackboneElement { + + /// Identifier, unique within the measure + public var identifier: Identifier? + + /// supplemental-data | risk-adjustment-factor + public var usage: [CodeableConcept]? + + /// Expression describing additional data to be reported + public var criteria: FHIRPrimitive? + + /// Path to the supplemental data element + public var path: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + criteria: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + path: FHIRPrimitive? = nil, + usage: [CodeableConcept]? = nil) + { + self.init() + self.criteria = criteria + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.path = path + self.usage = usage + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case criteria; case _criteria + case identifier + case path; case _path + case usage + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.criteria = try FHIRPrimitive(from: _container, forKeyIfPresent: .criteria, auxiliaryKey: ._criteria) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.path = try FHIRPrimitive(from: _container, forKeyIfPresent: .path, auxiliaryKey: ._path) + self.usage = try [CodeableConcept](from: _container, forKeyIfPresent: .usage) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try criteria?.encode(on: &_container, forKey: .criteria, auxiliaryKey: ._criteria) + try identifier?.encode(on: &_container, forKey: .identifier) + try path?.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + try usage?.encode(on: &_container, forKey: .usage) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MeasureSupplementalData else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return criteria == _other.criteria + && identifier == _other.identifier + && path == _other.path + && usage == _other.usage + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(criteria) + hasher.combine(identifier) + hasher.combine(path) + hasher.combine(usage) + } +} diff --git a/Sources/ModelsSTU3/MeasureReport.swift b/Sources/ModelsSTU3/MeasureReport.swift new file mode 100644 index 0000000..8cd1b54 --- /dev/null +++ b/Sources/ModelsSTU3/MeasureReport.swift @@ -0,0 +1,674 @@ +// +// MeasureReport.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MeasureReport) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Results of a measure evaluation. + + The MeasureReport resource contains the results of evaluating a measure. + */ +open class MeasureReport: DomainResource { + + override open class var resourceType: ResourceType { return .measureReport } + + /// Additional identifier for the Report + public var identifier: Identifier? + + /// The report status. No data will be available until the report status is complete. + public var status: FHIRPrimitive + + /// The type of measure report. This may be an individual report, which provides a single patient's score for the + /// measure; a patient listing, which returns the list of patients that meet the various criteria in the measure; or + /// a summary report, which returns a population count for each of the criteria in the measure. + public var type: FHIRPrimitive + + /// What measure was evaluated + public var measure: Reference + + /// What patient the report is for + public var patient: Reference? + + /// When the report was generated + public var date: FHIRPrimitive? + + /// Who is reporting the data + public var reportingOrganization: Reference? + + /// What period the report covers + public var period: Period + + /// Measure results for each group + public var group: [MeasureReportGroup]? + + /// What data was evaluated to produce the measure score + public var evaluatedResources: Reference? + + /// Designated initializer taking all required properties + public init(measure: Reference, period: Period, status: FHIRPrimitive, type: FHIRPrimitive) { + self.measure = measure + self.period = period + self.status = status + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + evaluatedResources: Reference? = nil, + `extension`: [Extension]? = nil, + group: [MeasureReportGroup]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + measure: Reference, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + patient: Reference? = nil, + period: Period, + reportingOrganization: Reference? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + type: FHIRPrimitive) + { + self.init(measure: measure, period: period, status: status, type: type) + self.contained = contained + self.date = date + self.evaluatedResources = evaluatedResources + self.`extension` = `extension` + self.group = group + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.patient = patient + self.reportingOrganization = reportingOrganization + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case date; case _date + case evaluatedResources + case group + case identifier + case measure + case patient + case period + case reportingOrganization + case status; case _status + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.evaluatedResources = try Reference(from: _container, forKeyIfPresent: .evaluatedResources) + self.group = try [MeasureReportGroup](from: _container, forKeyIfPresent: .group) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.measure = try Reference(from: _container, forKey: .measure) + self.patient = try Reference(from: _container, forKeyIfPresent: .patient) + self.period = try Period(from: _container, forKey: .period) + self.reportingOrganization = try Reference(from: _container, forKeyIfPresent: .reportingOrganization) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try evaluatedResources?.encode(on: &_container, forKey: .evaluatedResources) + try group?.encode(on: &_container, forKey: .group) + try identifier?.encode(on: &_container, forKey: .identifier) + try measure.encode(on: &_container, forKey: .measure) + try patient?.encode(on: &_container, forKey: .patient) + try period.encode(on: &_container, forKey: .period) + try reportingOrganization?.encode(on: &_container, forKey: .reportingOrganization) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MeasureReport else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return date == _other.date + && evaluatedResources == _other.evaluatedResources + && group == _other.group + && identifier == _other.identifier + && measure == _other.measure + && patient == _other.patient + && period == _other.period + && reportingOrganization == _other.reportingOrganization + && status == _other.status + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(date) + hasher.combine(evaluatedResources) + hasher.combine(group) + hasher.combine(identifier) + hasher.combine(measure) + hasher.combine(patient) + hasher.combine(period) + hasher.combine(reportingOrganization) + hasher.combine(status) + hasher.combine(type) + } +} + +/** + Measure results for each group. + + The results of the calculation, one for each population group in the measure. + */ +open class MeasureReportGroup: BackboneElement { + + /// What group of the measure + public var identifier: Identifier + + /// The populations in the group + public var population: [MeasureReportGroupPopulation]? + + /// What score this group achieved + public var measureScore: FHIRPrimitive? + + /// Stratification results + public var stratifier: [MeasureReportGroupStratifier]? + + /// Designated initializer taking all required properties + public init(identifier: Identifier) { + self.identifier = identifier + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier, + measureScore: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + population: [MeasureReportGroupPopulation]? = nil, + stratifier: [MeasureReportGroupStratifier]? = nil) + { + self.init(identifier: identifier) + self.`extension` = `extension` + self.id = id + self.measureScore = measureScore + self.modifierExtension = modifierExtension + self.population = population + self.stratifier = stratifier + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case identifier + case measureScore; case _measureScore + case population + case stratifier + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.identifier = try Identifier(from: _container, forKey: .identifier) + self.measureScore = try FHIRPrimitive(from: _container, forKeyIfPresent: .measureScore, auxiliaryKey: ._measureScore) + self.population = try [MeasureReportGroupPopulation](from: _container, forKeyIfPresent: .population) + self.stratifier = try [MeasureReportGroupStratifier](from: _container, forKeyIfPresent: .stratifier) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try identifier.encode(on: &_container, forKey: .identifier) + try measureScore?.encode(on: &_container, forKey: .measureScore, auxiliaryKey: ._measureScore) + try population?.encode(on: &_container, forKey: .population) + try stratifier?.encode(on: &_container, forKey: .stratifier) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MeasureReportGroup else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return identifier == _other.identifier + && measureScore == _other.measureScore + && population == _other.population + && stratifier == _other.stratifier + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(identifier) + hasher.combine(measureScore) + hasher.combine(population) + hasher.combine(stratifier) + } +} + +/** + The populations in the group. + + The populations that make up the population group, one for each type of population appropriate for the measure. + */ +open class MeasureReportGroupPopulation: BackboneElement { + + /// Population identifier as defined in the measure + public var identifier: Identifier? + + /// initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator- + /// exception | measure-population | measure-population-exclusion | measure-score + public var code: CodeableConcept? + + /// Size of the population + public var count: FHIRPrimitive? + + /// For patient-list reports, the patients in this population + public var patients: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept? = nil, + count: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + patients: Reference? = nil) + { + self.init() + self.code = code + self.count = count + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.patients = patients + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case count; case _count + case identifier + case patients + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.count = try FHIRPrimitive(from: _container, forKeyIfPresent: .count, auxiliaryKey: ._count) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.patients = try Reference(from: _container, forKeyIfPresent: .patients) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try count?.encode(on: &_container, forKey: .count, auxiliaryKey: ._count) + try identifier?.encode(on: &_container, forKey: .identifier) + try patients?.encode(on: &_container, forKey: .patients) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MeasureReportGroupPopulation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && count == _other.count + && identifier == _other.identifier + && patients == _other.patients + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(count) + hasher.combine(identifier) + hasher.combine(patients) + } +} + +/** + Stratification results. + + When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the + measure. + */ +open class MeasureReportGroupStratifier: BackboneElement { + + /// What stratifier of the group + public var identifier: Identifier? + + /// Stratum results, one for each unique value in the stratifier + public var stratum: [MeasureReportGroupStratifierStratum]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + stratum: [MeasureReportGroupStratifierStratum]? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.stratum = stratum + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case identifier + case stratum + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.stratum = try [MeasureReportGroupStratifierStratum](from: _container, forKeyIfPresent: .stratum) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try identifier?.encode(on: &_container, forKey: .identifier) + try stratum?.encode(on: &_container, forKey: .stratum) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MeasureReportGroupStratifier else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return identifier == _other.identifier + && stratum == _other.stratum + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(identifier) + hasher.combine(stratum) + } +} + +/** + Stratum results, one for each unique value in the stratifier. + + This element contains the results for a single stratum within the stratifier. For example, when stratifying on + administrative gender, there will be four strata, one for each possible gender value. + */ +open class MeasureReportGroupStratifierStratum: BackboneElement { + + /// The stratum value, e.g. male + public var value: FHIRPrimitive + + /// Population results in this stratum + public var population: [MeasureReportGroupStratifierStratumPopulation]? + + /// What score this stratum achieved + public var measureScore: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(value: FHIRPrimitive) { + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + measureScore: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + population: [MeasureReportGroupStratifierStratumPopulation]? = nil, + value: FHIRPrimitive) + { + self.init(value: value) + self.`extension` = `extension` + self.id = id + self.measureScore = measureScore + self.modifierExtension = modifierExtension + self.population = population + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case measureScore; case _measureScore + case population + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.measureScore = try FHIRPrimitive(from: _container, forKeyIfPresent: .measureScore, auxiliaryKey: ._measureScore) + self.population = try [MeasureReportGroupStratifierStratumPopulation](from: _container, forKeyIfPresent: .population) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try measureScore?.encode(on: &_container, forKey: .measureScore, auxiliaryKey: ._measureScore) + try population?.encode(on: &_container, forKey: .population) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MeasureReportGroupStratifierStratum else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return measureScore == _other.measureScore + && population == _other.population + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(measureScore) + hasher.combine(population) + hasher.combine(value) + } +} + +/** + Population results in this stratum. + + The populations that make up the stratum, one for each type of population appropriate to the measure. + */ +open class MeasureReportGroupStratifierStratumPopulation: BackboneElement { + + /// Population identifier as defined in the measure + public var identifier: Identifier? + + /// initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator- + /// exception | measure-population | measure-population-exclusion | measure-score + public var code: CodeableConcept? + + /// Size of the population + public var count: FHIRPrimitive? + + /// For patient-list reports, the patients in this population + public var patients: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept? = nil, + count: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + patients: Reference? = nil) + { + self.init() + self.code = code + self.count = count + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.patients = patients + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case count; case _count + case identifier + case patients + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.count = try FHIRPrimitive(from: _container, forKeyIfPresent: .count, auxiliaryKey: ._count) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.patients = try Reference(from: _container, forKeyIfPresent: .patients) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try count?.encode(on: &_container, forKey: .count, auxiliaryKey: ._count) + try identifier?.encode(on: &_container, forKey: .identifier) + try patients?.encode(on: &_container, forKey: .patients) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MeasureReportGroupStratifierStratumPopulation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && count == _other.count + && identifier == _other.identifier + && patients == _other.patients + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(count) + hasher.combine(identifier) + hasher.combine(patients) + } +} diff --git a/Sources/ModelsSTU3/Media.swift b/Sources/ModelsSTU3/Media.swift new file mode 100644 index 0000000..4b7bafa --- /dev/null +++ b/Sources/ModelsSTU3/Media.swift @@ -0,0 +1,300 @@ +// +// Media.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Media) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by + direct reference. + */ +open class Media: DomainResource { + + override open class var resourceType: ResourceType { return .media } + + /// All possible types for "occurrence[x]" + public enum OccurrenceX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// Identifier(s) for the image + public var identifier: [Identifier]? + + /// Procedure that caused this media to be created + public var basedOn: [Reference]? + + /// Whether the media is a photo (still image), an audio recording, or a video recording. + public var type: FHIRPrimitive + + /// The type of acquisition equipment/process + public var subtype: CodeableConcept? + + /// Imaging view, e.g. Lateral or Antero-posterior + public var view: CodeableConcept? + + /// Who/What this Media is a record of + public var subject: Reference? + + /// Encounter / Episode associated with media + public var context: Reference? + + /// When Media was collected + /// One of `occurrence[x]` + public var occurrence: OccurrenceX? + + /// The person who generated the image + public var `operator`: Reference? + + /// Why was event performed? + public var reasonCode: [CodeableConcept]? + + /// Body part in media + public var bodySite: CodeableConcept? + + /// Observing Device + public var device: Reference? + + /// Height of the image in pixels (photo/video) + public var height: FHIRPrimitive? + + /// Width of the image in pixels (photo/video) + public var width: FHIRPrimitive? + + /// Number of frames if > 1 (photo) + public var frames: FHIRPrimitive? + + /// Length in seconds (audio / video) + public var duration: FHIRPrimitive? + + /// Actual Media - reference or data + public var content: Attachment + + /// Comments made about the media + public var note: [Annotation]? + + /// Designated initializer taking all required properties + public init(content: Attachment, type: FHIRPrimitive) { + self.content = content + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + basedOn: [Reference]? = nil, + bodySite: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + content: Attachment, + context: Reference? = nil, + device: Reference? = nil, + duration: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + frames: FHIRPrimitive? = nil, + height: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + occurrence: OccurrenceX? = nil, + `operator`: Reference? = nil, + reasonCode: [CodeableConcept]? = nil, + subject: Reference? = nil, + subtype: CodeableConcept? = nil, + text: Narrative? = nil, + type: FHIRPrimitive, + view: CodeableConcept? = nil, + width: FHIRPrimitive? = nil) + { + self.init(content: content, type: type) + self.basedOn = basedOn + self.bodySite = bodySite + self.contained = contained + self.context = context + self.device = device + self.duration = duration + self.`extension` = `extension` + self.frames = frames + self.height = height + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.occurrence = occurrence + self.`operator` = `operator` + self.reasonCode = reasonCode + self.subject = subject + self.subtype = subtype + self.text = text + self.view = view + self.width = width + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case basedOn + case bodySite + case content + case context + case device + case duration; case _duration + case frames; case _frames + case height; case _height + case identifier + case note + case occurrenceDateTime; case _occurrenceDateTime + case occurrencePeriod + case `operator` = "operator" + case reasonCode + case subject + case subtype + case type; case _type + case view + case width; case _width + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.bodySite = try CodeableConcept(from: _container, forKeyIfPresent: .bodySite) + self.content = try Attachment(from: _container, forKey: .content) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.device = try Reference(from: _container, forKeyIfPresent: .device) + self.duration = try FHIRPrimitive(from: _container, forKeyIfPresent: .duration, auxiliaryKey: ._duration) + self.frames = try FHIRPrimitive(from: _container, forKeyIfPresent: .frames, auxiliaryKey: ._frames) + self.height = try FHIRPrimitive(from: _container, forKeyIfPresent: .height, auxiliaryKey: ._height) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + var _t_occurrence: OccurrenceX? = nil + if let occurrenceDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceDateTime, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .dateTime(occurrenceDateTime) + } + if let occurrencePeriod = try Period(from: _container, forKeyIfPresent: .occurrencePeriod) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrencePeriod, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .period(occurrencePeriod) + } + self.occurrence = _t_occurrence + self.`operator` = try Reference(from: _container, forKeyIfPresent: .`operator`) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.subtype = try CodeableConcept(from: _container, forKeyIfPresent: .subtype) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.view = try CodeableConcept(from: _container, forKeyIfPresent: .view) + self.width = try FHIRPrimitive(from: _container, forKeyIfPresent: .width, auxiliaryKey: ._width) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try basedOn?.encode(on: &_container, forKey: .basedOn) + try bodySite?.encode(on: &_container, forKey: .bodySite) + try content.encode(on: &_container, forKey: .content) + try context?.encode(on: &_container, forKey: .context) + try device?.encode(on: &_container, forKey: .device) + try duration?.encode(on: &_container, forKey: .duration, auxiliaryKey: ._duration) + try frames?.encode(on: &_container, forKey: .frames, auxiliaryKey: ._frames) + try height?.encode(on: &_container, forKey: .height, auxiliaryKey: ._height) + try identifier?.encode(on: &_container, forKey: .identifier) + try note?.encode(on: &_container, forKey: .note) + if let _enum = occurrence { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .occurrencePeriod) + } + } + try `operator`?.encode(on: &_container, forKey: .`operator`) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try subject?.encode(on: &_container, forKey: .subject) + try subtype?.encode(on: &_container, forKey: .subtype) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try view?.encode(on: &_container, forKey: .view) + try width?.encode(on: &_container, forKey: .width, auxiliaryKey: ._width) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Media else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return basedOn == _other.basedOn + && bodySite == _other.bodySite + && content == _other.content + && context == _other.context + && device == _other.device + && duration == _other.duration + && frames == _other.frames + && height == _other.height + && identifier == _other.identifier + && note == _other.note + && occurrence == _other.occurrence + && `operator` == _other.`operator` + && reasonCode == _other.reasonCode + && subject == _other.subject + && subtype == _other.subtype + && type == _other.type + && view == _other.view + && width == _other.width + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(basedOn) + hasher.combine(bodySite) + hasher.combine(content) + hasher.combine(context) + hasher.combine(device) + hasher.combine(duration) + hasher.combine(frames) + hasher.combine(height) + hasher.combine(identifier) + hasher.combine(note) + hasher.combine(occurrence) + hasher.combine(`operator`) + hasher.combine(reasonCode) + hasher.combine(subject) + hasher.combine(subtype) + hasher.combine(type) + hasher.combine(view) + hasher.combine(width) + } +} diff --git a/Sources/ModelsSTU3/Medication.swift b/Sources/ModelsSTU3/Medication.swift new file mode 100644 index 0000000..70c0205 --- /dev/null +++ b/Sources/ModelsSTU3/Medication.swift @@ -0,0 +1,594 @@ +// +// Medication.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Medication) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Definition of a Medication. + + This resource is primarily used for the identification and definition of a medication. It covers the ingredients and + the packaging for a medication. + */ +open class Medication: DomainResource { + + override open class var resourceType: ResourceType { return .medication } + + /// Codes that identify this medication + public var code: CodeableConcept? + + /// A code to indicate if the medication is in active use. + public var status: FHIRPrimitive? + + /// True if a brand + public var isBrand: FHIRPrimitive? + + /// True if medication does not require a prescription + public var isOverTheCounter: FHIRPrimitive? + + /// Manufacturer of the item + public var manufacturer: Reference? + + /// powder | tablets | capsule + + public var form: CodeableConcept? + + /// Active or inactive ingredient + public var ingredient: [MedicationIngredient]? + + /// Details about packaged medications + public var package: MedicationPackage? + + /// Picture of the medication + public var image: [Attachment]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + form: CodeableConcept? = nil, + id: FHIRPrimitive? = nil, + image: [Attachment]? = nil, + implicitRules: FHIRPrimitive? = nil, + ingredient: [MedicationIngredient]? = nil, + isBrand: FHIRPrimitive? = nil, + isOverTheCounter: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + manufacturer: Reference? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + package: MedicationPackage? = nil, + status: FHIRPrimitive? = nil, + text: Narrative? = nil) + { + self.init() + self.code = code + self.contained = contained + self.`extension` = `extension` + self.form = form + self.id = id + self.image = image + self.implicitRules = implicitRules + self.ingredient = ingredient + self.isBrand = isBrand + self.isOverTheCounter = isOverTheCounter + self.language = language + self.manufacturer = manufacturer + self.meta = meta + self.modifierExtension = modifierExtension + self.package = package + self.status = status + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case form + case image + case ingredient + case isBrand; case _isBrand + case isOverTheCounter; case _isOverTheCounter + case manufacturer + case package + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.form = try CodeableConcept(from: _container, forKeyIfPresent: .form) + self.image = try [Attachment](from: _container, forKeyIfPresent: .image) + self.ingredient = try [MedicationIngredient](from: _container, forKeyIfPresent: .ingredient) + self.isBrand = try FHIRPrimitive(from: _container, forKeyIfPresent: .isBrand, auxiliaryKey: ._isBrand) + self.isOverTheCounter = try FHIRPrimitive(from: _container, forKeyIfPresent: .isOverTheCounter, auxiliaryKey: ._isOverTheCounter) + self.manufacturer = try Reference(from: _container, forKeyIfPresent: .manufacturer) + self.package = try MedicationPackage(from: _container, forKeyIfPresent: .package) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try form?.encode(on: &_container, forKey: .form) + try image?.encode(on: &_container, forKey: .image) + try ingredient?.encode(on: &_container, forKey: .ingredient) + try isBrand?.encode(on: &_container, forKey: .isBrand, auxiliaryKey: ._isBrand) + try isOverTheCounter?.encode(on: &_container, forKey: .isOverTheCounter, auxiliaryKey: ._isOverTheCounter) + try manufacturer?.encode(on: &_container, forKey: .manufacturer) + try package?.encode(on: &_container, forKey: .package) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Medication else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && form == _other.form + && image == _other.image + && ingredient == _other.ingredient + && isBrand == _other.isBrand + && isOverTheCounter == _other.isOverTheCounter + && manufacturer == _other.manufacturer + && package == _other.package + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(form) + hasher.combine(image) + hasher.combine(ingredient) + hasher.combine(isBrand) + hasher.combine(isOverTheCounter) + hasher.combine(manufacturer) + hasher.combine(package) + hasher.combine(status) + } +} + +/** + Active or inactive ingredient. + + Identifies a particular constituent of interest in the product. + */ +open class MedicationIngredient: BackboneElement { + + /// All possible types for "item[x]" + public enum ItemX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// The product contained + /// One of `item[x]` + public var item: ItemX + + /// Active ingredient indicator + public var isActive: FHIRPrimitive? + + /// Quantity of ingredient present + public var amount: Ratio? + + /// Designated initializer taking all required properties + public init(item: ItemX) { + self.item = item + super.init() + } + + /// Convenience initializer + public convenience init( + amount: Ratio? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + isActive: FHIRPrimitive? = nil, + item: ItemX, + modifierExtension: [Extension]? = nil) + { + self.init(item: item) + self.amount = amount + self.`extension` = `extension` + self.id = id + self.isActive = isActive + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case amount + case isActive; case _isActive + case itemCodeableConcept + case itemReference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.itemCodeableConcept) || _container.contains(CodingKeys.itemReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.itemCodeableConcept, CodingKeys.itemReference], debugDescription: "Must have at least one value for \"item\" but have none")) + } + + // Decode all our properties + self.amount = try Ratio(from: _container, forKeyIfPresent: .amount) + self.isActive = try FHIRPrimitive(from: _container, forKeyIfPresent: .isActive, auxiliaryKey: ._isActive) + var _t_item: ItemX? = nil + if let itemCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .itemCodeableConcept) { + if _t_item != nil { + throw DecodingError.dataCorruptedError(forKey: .itemCodeableConcept, in: _container, debugDescription: "More than one value provided for \"item\"") + } + _t_item = .codeableConcept(itemCodeableConcept) + } + if let itemReference = try Reference(from: _container, forKeyIfPresent: .itemReference) { + if _t_item != nil { + throw DecodingError.dataCorruptedError(forKey: .itemReference, in: _container, debugDescription: "More than one value provided for \"item\"") + } + _t_item = .reference(itemReference) + } + self.item = _t_item! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try amount?.encode(on: &_container, forKey: .amount) + try isActive?.encode(on: &_container, forKey: .isActive, auxiliaryKey: ._isActive) + + switch item { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .itemCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .itemReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationIngredient else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return amount == _other.amount + && isActive == _other.isActive + && item == _other.item + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(amount) + hasher.combine(isActive) + hasher.combine(item) + } +} + +/** + Details about packaged medications. + + Information that only applies to packages (not products). + */ +open class MedicationPackage: BackboneElement { + + /// E.g. box, vial, blister-pack + public var container: CodeableConcept? + + /// What is in the package + public var content: [MedicationPackageContent]? + + /// Identifies a single production run + public var batch: [MedicationPackageBatch]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + batch: [MedicationPackageBatch]? = nil, + container: CodeableConcept? = nil, + content: [MedicationPackageContent]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.batch = batch + self.container = container + self.content = content + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case batch + case container + case content + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.batch = try [MedicationPackageBatch](from: _container, forKeyIfPresent: .batch) + self.container = try CodeableConcept(from: _container, forKeyIfPresent: .container) + self.content = try [MedicationPackageContent](from: _container, forKeyIfPresent: .content) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try batch?.encode(on: &_container, forKey: .batch) + try container?.encode(on: &_container, forKey: .container) + try content?.encode(on: &_container, forKey: .content) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationPackage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return batch == _other.batch + && container == _other.container + && content == _other.content + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(batch) + hasher.combine(container) + hasher.combine(content) + } +} + +/** + Identifies a single production run. + + Information about a group of medication produced or packaged from one production run. + */ +open class MedicationPackageBatch: BackboneElement { + + /// Identifier assigned to batch + public var lotNumber: FHIRPrimitive? + + /// When batch will expire + public var expirationDate: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + expirationDate: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + lotNumber: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.expirationDate = expirationDate + self.`extension` = `extension` + self.id = id + self.lotNumber = lotNumber + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case expirationDate; case _expirationDate + case lotNumber; case _lotNumber + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.expirationDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .expirationDate, auxiliaryKey: ._expirationDate) + self.lotNumber = try FHIRPrimitive(from: _container, forKeyIfPresent: .lotNumber, auxiliaryKey: ._lotNumber) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try expirationDate?.encode(on: &_container, forKey: .expirationDate, auxiliaryKey: ._expirationDate) + try lotNumber?.encode(on: &_container, forKey: .lotNumber, auxiliaryKey: ._lotNumber) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationPackageBatch else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return expirationDate == _other.expirationDate + && lotNumber == _other.lotNumber + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(expirationDate) + hasher.combine(lotNumber) + } +} + +/** + What is in the package. + + A set of components that go to make up the described item. + */ +open class MedicationPackageContent: BackboneElement { + + /// All possible types for "item[x]" + public enum ItemX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// The item in the package + /// One of `item[x]` + public var item: ItemX + + /// Quantity present in the package + public var amount: Quantity? + + /// Designated initializer taking all required properties + public init(item: ItemX) { + self.item = item + super.init() + } + + /// Convenience initializer + public convenience init( + amount: Quantity? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + item: ItemX, + modifierExtension: [Extension]? = nil) + { + self.init(item: item) + self.amount = amount + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case amount + case itemCodeableConcept + case itemReference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.itemCodeableConcept) || _container.contains(CodingKeys.itemReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.itemCodeableConcept, CodingKeys.itemReference], debugDescription: "Must have at least one value for \"item\" but have none")) + } + + // Decode all our properties + self.amount = try Quantity(from: _container, forKeyIfPresent: .amount) + var _t_item: ItemX? = nil + if let itemCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .itemCodeableConcept) { + if _t_item != nil { + throw DecodingError.dataCorruptedError(forKey: .itemCodeableConcept, in: _container, debugDescription: "More than one value provided for \"item\"") + } + _t_item = .codeableConcept(itemCodeableConcept) + } + if let itemReference = try Reference(from: _container, forKeyIfPresent: .itemReference) { + if _t_item != nil { + throw DecodingError.dataCorruptedError(forKey: .itemReference, in: _container, debugDescription: "More than one value provided for \"item\"") + } + _t_item = .reference(itemReference) + } + self.item = _t_item! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try amount?.encode(on: &_container, forKey: .amount) + + switch item { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .itemCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .itemReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationPackageContent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return amount == _other.amount + && item == _other.item + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(amount) + hasher.combine(item) + } +} diff --git a/Sources/ModelsSTU3/MedicationAdministration.swift b/Sources/ModelsSTU3/MedicationAdministration.swift new file mode 100644 index 0000000..f188585 --- /dev/null +++ b/Sources/ModelsSTU3/MedicationAdministration.swift @@ -0,0 +1,591 @@ +// +// MedicationAdministration.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Administration of medication to a patient. + + Describes the event of a patient consuming or otherwise being administered a medication. This may be as simple as + swallowing a tablet or it may be a long running infusion. Related resources tie this event to the authorizing + prescription, and the specific encounter between patient and health care practitioner. + */ +open class MedicationAdministration: DomainResource { + + override open class var resourceType: ResourceType { return .medicationAdministration } + + /// All possible types for "effective[x]" + public enum EffectiveX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// All possible types for "medication[x]" + public enum MedicationX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// External identifier + public var identifier: [Identifier]? + + /// Instantiates protocol or definition + public var definition: [Reference]? + + /// Part of referenced event + public var partOf: [Reference]? + + /// Will generally be set to show that the administration has been completed. For some long running administrations + /// such as infusions it is possible for an administration to be started but not completed or it may be paused while + /// some other process is under way. + public var status: FHIRPrimitive + + /// Type of medication usage + public var category: CodeableConcept? + + /// What was administered + /// One of `medication[x]` + public var medication: MedicationX + + /// Who received medication + public var subject: Reference + + /// Encounter or Episode of Care administered as part of + public var context: Reference? + + /// Additional information to support administration + public var supportingInformation: [Reference]? + + /// Start and end time of administration + /// One of `effective[x]` + public var effective: EffectiveX + + /// Who administered substance + public var performer: [MedicationAdministrationPerformer]? + + /// True if medication not administered + public var notGiven: FHIRPrimitive? + + /// Reason administration not performed + public var reasonNotGiven: [CodeableConcept]? + + /// Reason administration performed + public var reasonCode: [CodeableConcept]? + + /// Condition or Observation that supports why the medication was administered + public var reasonReference: [Reference]? + + /// Request administration performed against + public var prescription: Reference? + + /// Device used to administer + public var device: [Reference]? + + /// Information about the administration + public var note: [Annotation]? + + /// Details of how medication was taken + public var dosage: MedicationAdministrationDosage? + + /// A list of events of interest in the lifecycle + public var eventHistory: [Reference]? + + /// Designated initializer taking all required properties + public init(effective: EffectiveX, medication: MedicationX, status: FHIRPrimitive, subject: Reference) { + self.effective = effective + self.medication = medication + self.status = status + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + category: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: [Reference]? = nil, + device: [Reference]? = nil, + dosage: MedicationAdministrationDosage? = nil, + effective: EffectiveX, + eventHistory: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + medication: MedicationX, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + notGiven: FHIRPrimitive? = nil, + note: [Annotation]? = nil, + partOf: [Reference]? = nil, + performer: [MedicationAdministrationPerformer]? = nil, + prescription: Reference? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonNotGiven: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + status: FHIRPrimitive, + subject: Reference, + supportingInformation: [Reference]? = nil, + text: Narrative? = nil) + { + self.init(effective: effective, medication: medication, status: status, subject: subject) + self.category = category + self.contained = contained + self.context = context + self.definition = definition + self.device = device + self.dosage = dosage + self.eventHistory = eventHistory + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.notGiven = notGiven + self.note = note + self.partOf = partOf + self.performer = performer + self.prescription = prescription + self.reasonCode = reasonCode + self.reasonNotGiven = reasonNotGiven + self.reasonReference = reasonReference + self.supportingInformation = supportingInformation + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category + case context + case definition + case device + case dosage + case effectiveDateTime; case _effectiveDateTime + case effectivePeriod + case eventHistory + case identifier + case medicationCodeableConcept + case medicationReference + case notGiven; case _notGiven + case note + case partOf + case performer + case prescription + case reasonCode + case reasonNotGiven + case reasonReference + case status; case _status + case subject + case supportingInformation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.medicationCodeableConcept) || _container.contains(CodingKeys.medicationReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.medicationCodeableConcept, CodingKeys.medicationReference], debugDescription: "Must have at least one value for \"medication\" but have none")) + } + guard _container.contains(CodingKeys.effectiveDateTime) || _container.contains(CodingKeys.effectivePeriod) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.effectiveDateTime, CodingKeys.effectivePeriod], debugDescription: "Must have at least one value for \"effective\" but have none")) + } + + // Decode all our properties + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.definition = try [Reference](from: _container, forKeyIfPresent: .definition) + self.device = try [Reference](from: _container, forKeyIfPresent: .device) + self.dosage = try MedicationAdministrationDosage(from: _container, forKeyIfPresent: .dosage) + var _t_effective: EffectiveX? = nil + if let effectiveDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .effectiveDateTime, auxiliaryKey: ._effectiveDateTime) { + if _t_effective != nil { + throw DecodingError.dataCorruptedError(forKey: .effectiveDateTime, in: _container, debugDescription: "More than one value provided for \"effective\"") + } + _t_effective = .dateTime(effectiveDateTime) + } + if let effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) { + if _t_effective != nil { + throw DecodingError.dataCorruptedError(forKey: .effectivePeriod, in: _container, debugDescription: "More than one value provided for \"effective\"") + } + _t_effective = .period(effectivePeriod) + } + self.effective = _t_effective! + self.eventHistory = try [Reference](from: _container, forKeyIfPresent: .eventHistory) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + var _t_medication: MedicationX? = nil + if let medicationCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .medicationCodeableConcept) { + if _t_medication != nil { + throw DecodingError.dataCorruptedError(forKey: .medicationCodeableConcept, in: _container, debugDescription: "More than one value provided for \"medication\"") + } + _t_medication = .codeableConcept(medicationCodeableConcept) + } + if let medicationReference = try Reference(from: _container, forKeyIfPresent: .medicationReference) { + if _t_medication != nil { + throw DecodingError.dataCorruptedError(forKey: .medicationReference, in: _container, debugDescription: "More than one value provided for \"medication\"") + } + _t_medication = .reference(medicationReference) + } + self.medication = _t_medication! + self.notGiven = try FHIRPrimitive(from: _container, forKeyIfPresent: .notGiven, auxiliaryKey: ._notGiven) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.partOf = try [Reference](from: _container, forKeyIfPresent: .partOf) + self.performer = try [MedicationAdministrationPerformer](from: _container, forKeyIfPresent: .performer) + self.prescription = try Reference(from: _container, forKeyIfPresent: .prescription) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonNotGiven = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonNotGiven) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.supportingInformation = try [Reference](from: _container, forKeyIfPresent: .supportingInformation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category?.encode(on: &_container, forKey: .category) + try context?.encode(on: &_container, forKey: .context) + try definition?.encode(on: &_container, forKey: .definition) + try device?.encode(on: &_container, forKey: .device) + try dosage?.encode(on: &_container, forKey: .dosage) + + switch effective { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .effectiveDateTime, auxiliaryKey: ._effectiveDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .effectivePeriod) + } + + try eventHistory?.encode(on: &_container, forKey: .eventHistory) + try identifier?.encode(on: &_container, forKey: .identifier) + + switch medication { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .medicationCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .medicationReference) + } + + try notGiven?.encode(on: &_container, forKey: .notGiven, auxiliaryKey: ._notGiven) + try note?.encode(on: &_container, forKey: .note) + try partOf?.encode(on: &_container, forKey: .partOf) + try performer?.encode(on: &_container, forKey: .performer) + try prescription?.encode(on: &_container, forKey: .prescription) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonNotGiven?.encode(on: &_container, forKey: .reasonNotGiven) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try supportingInformation?.encode(on: &_container, forKey: .supportingInformation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationAdministration else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && context == _other.context + && definition == _other.definition + && device == _other.device + && dosage == _other.dosage + && effective == _other.effective + && eventHistory == _other.eventHistory + && identifier == _other.identifier + && medication == _other.medication + && notGiven == _other.notGiven + && note == _other.note + && partOf == _other.partOf + && performer == _other.performer + && prescription == _other.prescription + && reasonCode == _other.reasonCode + && reasonNotGiven == _other.reasonNotGiven + && reasonReference == _other.reasonReference + && status == _other.status + && subject == _other.subject + && supportingInformation == _other.supportingInformation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(device) + hasher.combine(dosage) + hasher.combine(effective) + hasher.combine(eventHistory) + hasher.combine(identifier) + hasher.combine(medication) + hasher.combine(notGiven) + hasher.combine(note) + hasher.combine(partOf) + hasher.combine(performer) + hasher.combine(prescription) + hasher.combine(reasonCode) + hasher.combine(reasonNotGiven) + hasher.combine(reasonReference) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(supportingInformation) + } +} + +/** + Details of how medication was taken. + + Describes the medication dosage information details e.g. dose, rate, site, route, etc. + */ +open class MedicationAdministrationDosage: BackboneElement { + + /// All possible types for "rate[x]" + public enum RateX: Hashable { + case quantity(Quantity) + case ratio(Ratio) + } + + /// Free text dosage instructions e.g. SIG + public var text: FHIRPrimitive? + + /// Body site administered to + public var site: CodeableConcept? + + /// Path of substance into body + public var route: CodeableConcept? + + /// How drug was administered + public var method: CodeableConcept? + + /// Amount of medication per dose + public var dose: Quantity? + + /// Dose quantity per unit of time + /// One of `rate[x]` + public var rate: RateX? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + dose: Quantity? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + method: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil, + rate: RateX? = nil, + route: CodeableConcept? = nil, + site: CodeableConcept? = nil, + text: FHIRPrimitive? = nil) + { + self.init() + self.dose = dose + self.`extension` = `extension` + self.id = id + self.method = method + self.modifierExtension = modifierExtension + self.rate = rate + self.route = route + self.site = site + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case dose + case method + case rateQuantity + case rateRatio + case route + case site + case text; case _text + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.dose = try Quantity(from: _container, forKeyIfPresent: .dose) + self.method = try CodeableConcept(from: _container, forKeyIfPresent: .method) + var _t_rate: RateX? = nil + if let rateRatio = try Ratio(from: _container, forKeyIfPresent: .rateRatio) { + if _t_rate != nil { + throw DecodingError.dataCorruptedError(forKey: .rateRatio, in: _container, debugDescription: "More than one value provided for \"rate\"") + } + _t_rate = .ratio(rateRatio) + } + if let rateQuantity = try Quantity(from: _container, forKeyIfPresent: .rateQuantity) { + if _t_rate != nil { + throw DecodingError.dataCorruptedError(forKey: .rateQuantity, in: _container, debugDescription: "More than one value provided for \"rate\"") + } + _t_rate = .quantity(rateQuantity) + } + self.rate = _t_rate + self.route = try CodeableConcept(from: _container, forKeyIfPresent: .route) + self.site = try CodeableConcept(from: _container, forKeyIfPresent: .site) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try dose?.encode(on: &_container, forKey: .dose) + try method?.encode(on: &_container, forKey: .method) + if let _enum = rate { + switch _enum { + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .rateRatio) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .rateQuantity) + } + } + try route?.encode(on: &_container, forKey: .route) + try site?.encode(on: &_container, forKey: .site) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationAdministrationDosage else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return dose == _other.dose + && method == _other.method + && rate == _other.rate + && route == _other.route + && site == _other.site + && text == _other.text + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(dose) + hasher.combine(method) + hasher.combine(rate) + hasher.combine(route) + hasher.combine(site) + hasher.combine(text) + } +} + +/** + Who administered substance. + + The individual who was responsible for giving the medication to the patient. + */ +open class MedicationAdministrationPerformer: BackboneElement { + + /// Individual who was performing + public var actor: Reference + + /// Organization organization was acting for + public var onBehalfOf: Reference? + + /// Designated initializer taking all required properties + public init(actor: Reference) { + self.actor = actor + super.init() + } + + /// Convenience initializer + public convenience init( + actor: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil) + { + self.init(actor: actor) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actor + case onBehalfOf + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actor = try Reference(from: _container, forKey: .actor) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actor.encode(on: &_container, forKey: .actor) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationAdministrationPerformer else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actor == _other.actor + && onBehalfOf == _other.onBehalfOf + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actor) + hasher.combine(onBehalfOf) + } +} diff --git a/Sources/ModelsSTU3/MedicationDispense.swift b/Sources/ModelsSTU3/MedicationDispense.swift new file mode 100644 index 0000000..b8e4fbf --- /dev/null +++ b/Sources/ModelsSTU3/MedicationDispense.swift @@ -0,0 +1,580 @@ +// +// MedicationDispense.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MedicationDispense) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Dispensing a medication to a named patient. + + Indicates that a medication product is to be or has been dispensed for a named person/patient. This includes a + description of the medication product (supply) provided and the instructions for administering the medication. The + medication dispense is the result of a pharmacy system responding to a medication order. + */ +open class MedicationDispense: DomainResource { + + override open class var resourceType: ResourceType { return .medicationDispense } + + /// All possible types for "medication[x]" + public enum MedicationX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// All possible types for "notDoneReason[x]" + public enum NotDoneReasonX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// External identifier + public var identifier: [Identifier]? + + /// Event that dispense is part of + public var partOf: [Reference]? + + /// A code specifying the state of the set of dispense events. + public var status: FHIRPrimitive? + + /// Type of medication dispense + public var category: CodeableConcept? + + /// What medication was supplied + /// One of `medication[x]` + public var medication: MedicationX + + /// Who the dispense is for + public var subject: Reference? + + /// Encounter / Episode associated with event + public var context: Reference? + + /// Information that supports the dispensing of the medication + public var supportingInformation: [Reference]? + + /// Who performed event + public var performer: [MedicationDispensePerformer]? + + /// Medication order that authorizes the dispense + public var authorizingPrescription: [Reference]? + + /// Trial fill, partial fill, emergency fill, etc. + public var type: CodeableConcept? + + /// Amount dispensed + public var quantity: Quantity? + + /// Amount of medication expressed as a timing amount + public var daysSupply: Quantity? + + /// When product was packaged and reviewed + public var whenPrepared: FHIRPrimitive? + + /// When product was given out + public var whenHandedOver: FHIRPrimitive? + + /// Where the medication was sent + public var destination: Reference? + + /// Who collected the medication + public var receiver: [Reference]? + + /// Information about the dispense + public var note: [Annotation]? + + /// How the medication is to be used by the patient or administered by the caregiver + public var dosageInstruction: [Dosage]? + + /// Whether a substitution was performed on the dispense + public var substitution: MedicationDispenseSubstitution? + + /// Clinical issue with action + public var detectedIssue: [Reference]? + + /// Whether the dispense was or was not performed + public var notDone: FHIRPrimitive? + + /// Why a dispense was not performed + /// One of `notDoneReason[x]` + public var notDoneReason: NotDoneReasonX? + + /// A list of releveant lifecycle events + public var eventHistory: [Reference]? + + /// Designated initializer taking all required properties + public init(medication: MedicationX) { + self.medication = medication + super.init() + } + + /// Convenience initializer + public convenience init( + authorizingPrescription: [Reference]? = nil, + category: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + daysSupply: Quantity? = nil, + destination: Reference? = nil, + detectedIssue: [Reference]? = nil, + dosageInstruction: [Dosage]? = nil, + eventHistory: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + medication: MedicationX, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + notDone: FHIRPrimitive? = nil, + notDoneReason: NotDoneReasonX? = nil, + note: [Annotation]? = nil, + partOf: [Reference]? = nil, + performer: [MedicationDispensePerformer]? = nil, + quantity: Quantity? = nil, + receiver: [Reference]? = nil, + status: FHIRPrimitive? = nil, + subject: Reference? = nil, + substitution: MedicationDispenseSubstitution? = nil, + supportingInformation: [Reference]? = nil, + text: Narrative? = nil, + type: CodeableConcept? = nil, + whenHandedOver: FHIRPrimitive? = nil, + whenPrepared: FHIRPrimitive? = nil) + { + self.init(medication: medication) + self.authorizingPrescription = authorizingPrescription + self.category = category + self.contained = contained + self.context = context + self.daysSupply = daysSupply + self.destination = destination + self.detectedIssue = detectedIssue + self.dosageInstruction = dosageInstruction + self.eventHistory = eventHistory + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.notDone = notDone + self.notDoneReason = notDoneReason + self.note = note + self.partOf = partOf + self.performer = performer + self.quantity = quantity + self.receiver = receiver + self.status = status + self.subject = subject + self.substitution = substitution + self.supportingInformation = supportingInformation + self.text = text + self.type = type + self.whenHandedOver = whenHandedOver + self.whenPrepared = whenPrepared + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authorizingPrescription + case category + case context + case daysSupply + case destination + case detectedIssue + case dosageInstruction + case eventHistory + case identifier + case medicationCodeableConcept + case medicationReference + case notDone; case _notDone + case notDoneReasonCodeableConcept + case notDoneReasonReference + case note + case partOf + case performer + case quantity + case receiver + case status; case _status + case subject + case substitution + case supportingInformation + case type + case whenHandedOver; case _whenHandedOver + case whenPrepared; case _whenPrepared + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.medicationCodeableConcept) || _container.contains(CodingKeys.medicationReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.medicationCodeableConcept, CodingKeys.medicationReference], debugDescription: "Must have at least one value for \"medication\" but have none")) + } + + // Decode all our properties + self.authorizingPrescription = try [Reference](from: _container, forKeyIfPresent: .authorizingPrescription) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.daysSupply = try Quantity(from: _container, forKeyIfPresent: .daysSupply) + self.destination = try Reference(from: _container, forKeyIfPresent: .destination) + self.detectedIssue = try [Reference](from: _container, forKeyIfPresent: .detectedIssue) + self.dosageInstruction = try [Dosage](from: _container, forKeyIfPresent: .dosageInstruction) + self.eventHistory = try [Reference](from: _container, forKeyIfPresent: .eventHistory) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + var _t_medication: MedicationX? = nil + if let medicationCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .medicationCodeableConcept) { + if _t_medication != nil { + throw DecodingError.dataCorruptedError(forKey: .medicationCodeableConcept, in: _container, debugDescription: "More than one value provided for \"medication\"") + } + _t_medication = .codeableConcept(medicationCodeableConcept) + } + if let medicationReference = try Reference(from: _container, forKeyIfPresent: .medicationReference) { + if _t_medication != nil { + throw DecodingError.dataCorruptedError(forKey: .medicationReference, in: _container, debugDescription: "More than one value provided for \"medication\"") + } + _t_medication = .reference(medicationReference) + } + self.medication = _t_medication! + self.notDone = try FHIRPrimitive(from: _container, forKeyIfPresent: .notDone, auxiliaryKey: ._notDone) + var _t_notDoneReason: NotDoneReasonX? = nil + if let notDoneReasonCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .notDoneReasonCodeableConcept) { + if _t_notDoneReason != nil { + throw DecodingError.dataCorruptedError(forKey: .notDoneReasonCodeableConcept, in: _container, debugDescription: "More than one value provided for \"notDoneReason\"") + } + _t_notDoneReason = .codeableConcept(notDoneReasonCodeableConcept) + } + if let notDoneReasonReference = try Reference(from: _container, forKeyIfPresent: .notDoneReasonReference) { + if _t_notDoneReason != nil { + throw DecodingError.dataCorruptedError(forKey: .notDoneReasonReference, in: _container, debugDescription: "More than one value provided for \"notDoneReason\"") + } + _t_notDoneReason = .reference(notDoneReasonReference) + } + self.notDoneReason = _t_notDoneReason + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.partOf = try [Reference](from: _container, forKeyIfPresent: .partOf) + self.performer = try [MedicationDispensePerformer](from: _container, forKeyIfPresent: .performer) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.receiver = try [Reference](from: _container, forKeyIfPresent: .receiver) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.substitution = try MedicationDispenseSubstitution(from: _container, forKeyIfPresent: .substitution) + self.supportingInformation = try [Reference](from: _container, forKeyIfPresent: .supportingInformation) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + self.whenHandedOver = try FHIRPrimitive(from: _container, forKeyIfPresent: .whenHandedOver, auxiliaryKey: ._whenHandedOver) + self.whenPrepared = try FHIRPrimitive(from: _container, forKeyIfPresent: .whenPrepared, auxiliaryKey: ._whenPrepared) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authorizingPrescription?.encode(on: &_container, forKey: .authorizingPrescription) + try category?.encode(on: &_container, forKey: .category) + try context?.encode(on: &_container, forKey: .context) + try daysSupply?.encode(on: &_container, forKey: .daysSupply) + try destination?.encode(on: &_container, forKey: .destination) + try detectedIssue?.encode(on: &_container, forKey: .detectedIssue) + try dosageInstruction?.encode(on: &_container, forKey: .dosageInstruction) + try eventHistory?.encode(on: &_container, forKey: .eventHistory) + try identifier?.encode(on: &_container, forKey: .identifier) + + switch medication { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .medicationCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .medicationReference) + } + + try notDone?.encode(on: &_container, forKey: .notDone, auxiliaryKey: ._notDone) + if let _enum = notDoneReason { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .notDoneReasonCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .notDoneReasonReference) + } + } + try note?.encode(on: &_container, forKey: .note) + try partOf?.encode(on: &_container, forKey: .partOf) + try performer?.encode(on: &_container, forKey: .performer) + try quantity?.encode(on: &_container, forKey: .quantity) + try receiver?.encode(on: &_container, forKey: .receiver) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try substitution?.encode(on: &_container, forKey: .substitution) + try supportingInformation?.encode(on: &_container, forKey: .supportingInformation) + try type?.encode(on: &_container, forKey: .type) + try whenHandedOver?.encode(on: &_container, forKey: .whenHandedOver, auxiliaryKey: ._whenHandedOver) + try whenPrepared?.encode(on: &_container, forKey: .whenPrepared, auxiliaryKey: ._whenPrepared) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationDispense else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authorizingPrescription == _other.authorizingPrescription + && category == _other.category + && context == _other.context + && daysSupply == _other.daysSupply + && destination == _other.destination + && detectedIssue == _other.detectedIssue + && dosageInstruction == _other.dosageInstruction + && eventHistory == _other.eventHistory + && identifier == _other.identifier + && medication == _other.medication + && notDone == _other.notDone + && notDoneReason == _other.notDoneReason + && note == _other.note + && partOf == _other.partOf + && performer == _other.performer + && quantity == _other.quantity + && receiver == _other.receiver + && status == _other.status + && subject == _other.subject + && substitution == _other.substitution + && supportingInformation == _other.supportingInformation + && type == _other.type + && whenHandedOver == _other.whenHandedOver + && whenPrepared == _other.whenPrepared + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authorizingPrescription) + hasher.combine(category) + hasher.combine(context) + hasher.combine(daysSupply) + hasher.combine(destination) + hasher.combine(detectedIssue) + hasher.combine(dosageInstruction) + hasher.combine(eventHistory) + hasher.combine(identifier) + hasher.combine(medication) + hasher.combine(notDone) + hasher.combine(notDoneReason) + hasher.combine(note) + hasher.combine(partOf) + hasher.combine(performer) + hasher.combine(quantity) + hasher.combine(receiver) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(substitution) + hasher.combine(supportingInformation) + hasher.combine(type) + hasher.combine(whenHandedOver) + hasher.combine(whenPrepared) + } +} + +/** + Who performed event. + + Indicates who or what performed the event. It should be assumed that the performer is the dispenser of the medication. + */ +open class MedicationDispensePerformer: BackboneElement { + + /// Individual who was performing + public var actor: Reference + + /// Organization organization was acting for + public var onBehalfOf: Reference? + + /// Designated initializer taking all required properties + public init(actor: Reference) { + self.actor = actor + super.init() + } + + /// Convenience initializer + public convenience init( + actor: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil) + { + self.init(actor: actor) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actor + case onBehalfOf + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actor = try Reference(from: _container, forKey: .actor) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actor.encode(on: &_container, forKey: .actor) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationDispensePerformer else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actor == _other.actor + && onBehalfOf == _other.onBehalfOf + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actor) + hasher.combine(onBehalfOf) + } +} + +/** + Whether a substitution was performed on the dispense. + + Indicates whether or not substitution was made as part of the dispense. In some cases substitution will be expected + but does not happen, in other cases substitution is not expected but does happen. This block explains what + substitution did or did not happen and why. If nothing is specified, substitution was not done. + */ +open class MedicationDispenseSubstitution: BackboneElement { + + /// Whether a substitution was or was not performed on the dispense + public var wasSubstituted: FHIRPrimitive + + /// Code signifying whether a different drug was dispensed from what was prescribed + public var type: CodeableConcept? + + /// Why was substitution made + public var reason: [CodeableConcept]? + + /// Who is responsible for the substitution + public var responsibleParty: [Reference]? + + /// Designated initializer taking all required properties + public init(wasSubstituted: FHIRPrimitive) { + self.wasSubstituted = wasSubstituted + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reason: [CodeableConcept]? = nil, + responsibleParty: [Reference]? = nil, + type: CodeableConcept? = nil, + wasSubstituted: FHIRPrimitive) + { + self.init(wasSubstituted: wasSubstituted) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reason = reason + self.responsibleParty = responsibleParty + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case reason + case responsibleParty + case type + case wasSubstituted; case _wasSubstituted + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.reason = try [CodeableConcept](from: _container, forKeyIfPresent: .reason) + self.responsibleParty = try [Reference](from: _container, forKeyIfPresent: .responsibleParty) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + self.wasSubstituted = try FHIRPrimitive(from: _container, forKey: .wasSubstituted, auxiliaryKey: ._wasSubstituted) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try reason?.encode(on: &_container, forKey: .reason) + try responsibleParty?.encode(on: &_container, forKey: .responsibleParty) + try type?.encode(on: &_container, forKey: .type) + try wasSubstituted.encode(on: &_container, forKey: .wasSubstituted, auxiliaryKey: ._wasSubstituted) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationDispenseSubstitution else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return reason == _other.reason + && responsibleParty == _other.responsibleParty + && type == _other.type + && wasSubstituted == _other.wasSubstituted + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(reason) + hasher.combine(responsibleParty) + hasher.combine(type) + hasher.combine(wasSubstituted) + } +} diff --git a/Sources/ModelsSTU3/MedicationRequest.swift b/Sources/ModelsSTU3/MedicationRequest.swift new file mode 100644 index 0000000..9d64492 --- /dev/null +++ b/Sources/ModelsSTU3/MedicationRequest.swift @@ -0,0 +1,647 @@ +// +// MedicationRequest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MedicationRequest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Ordering of medication for patient or group. + + An order or request for both supply of the medication and the instructions for administration of the medication to a + patient. The resource is called "MedicationRequest" rather than "MedicationPrescription" or "MedicationOrder" to + generalize the use across inpatient and outpatient settings, including care plans, etc., and to harmonize with workflow + patterns. + */ +open class MedicationRequest: DomainResource { + + override open class var resourceType: ResourceType { return .medicationRequest } + + /// All possible types for "medication[x]" + public enum MedicationX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// External ids for this request + public var identifier: [Identifier]? + + /// Protocol or definition + public var definition: [Reference]? + + /// What request fulfills + public var basedOn: [Reference]? + + /// Composite request this is part of + public var groupIdentifier: Identifier? + + /// A code specifying the current state of the order. Generally this will be active or completed state. + public var status: FHIRPrimitive? + + /// Whether the request is a proposal, plan, or an original order. + public var intent: FHIRPrimitive + + /// Type of medication usage + public var category: CodeableConcept? + + /// Indicates how quickly the Medication Request should be addressed with respect to other requests. + public var priority: FHIRPrimitive? + + /// Medication to be taken + /// One of `medication[x]` + public var medication: MedicationX + + /// Who or group medication request is for + public var subject: Reference + + /// Created during encounter/admission/stay + public var context: Reference? + + /// Information to support ordering of the medication + public var supportingInformation: [Reference]? + + /// When request was initially authored + public var authoredOn: FHIRPrimitive? + + /// Who/What requested the Request + public var requester: MedicationRequestRequester? + + /// Person who entered the request + public var recorder: Reference? + + /// Reason or indication for writing the prescription + public var reasonCode: [CodeableConcept]? + + /// Condition or Observation that supports why the prescription is being written + public var reasonReference: [Reference]? + + /// Information about the prescription + public var note: [Annotation]? + + /// How the medication should be taken + public var dosageInstruction: [Dosage]? + + /// Medication supply authorization + public var dispenseRequest: MedicationRequestDispenseRequest? + + /// Any restrictions on medication substitution + public var substitution: MedicationRequestSubstitution? + + /// An order/prescription that is being replaced + public var priorPrescription: Reference? + + /// Clinical Issue with action + public var detectedIssue: [Reference]? + + /// A list of events of interest in the lifecycle + public var eventHistory: [Reference]? + + /// Designated initializer taking all required properties + public init(intent: FHIRPrimitive, medication: MedicationX, subject: Reference) { + self.intent = intent + self.medication = medication + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + authoredOn: FHIRPrimitive? = nil, + basedOn: [Reference]? = nil, + category: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: [Reference]? = nil, + detectedIssue: [Reference]? = nil, + dispenseRequest: MedicationRequestDispenseRequest? = nil, + dosageInstruction: [Dosage]? = nil, + eventHistory: [Reference]? = nil, + `extension`: [Extension]? = nil, + groupIdentifier: Identifier? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + intent: FHIRPrimitive, + language: FHIRPrimitive? = nil, + medication: MedicationX, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + priorPrescription: Reference? = nil, + priority: FHIRPrimitive? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + recorder: Reference? = nil, + requester: MedicationRequestRequester? = nil, + status: FHIRPrimitive? = nil, + subject: Reference, + substitution: MedicationRequestSubstitution? = nil, + supportingInformation: [Reference]? = nil, + text: Narrative? = nil) + { + self.init(intent: intent, medication: medication, subject: subject) + self.authoredOn = authoredOn + self.basedOn = basedOn + self.category = category + self.contained = contained + self.context = context + self.definition = definition + self.detectedIssue = detectedIssue + self.dispenseRequest = dispenseRequest + self.dosageInstruction = dosageInstruction + self.eventHistory = eventHistory + self.`extension` = `extension` + self.groupIdentifier = groupIdentifier + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.priorPrescription = priorPrescription + self.priority = priority + self.reasonCode = reasonCode + self.reasonReference = reasonReference + self.recorder = recorder + self.requester = requester + self.status = status + self.substitution = substitution + self.supportingInformation = supportingInformation + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authoredOn; case _authoredOn + case basedOn + case category + case context + case definition + case detectedIssue + case dispenseRequest + case dosageInstruction + case eventHistory + case groupIdentifier + case identifier + case intent; case _intent + case medicationCodeableConcept + case medicationReference + case note + case priorPrescription + case priority; case _priority + case reasonCode + case reasonReference + case recorder + case requester + case status; case _status + case subject + case substitution + case supportingInformation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.medicationCodeableConcept) || _container.contains(CodingKeys.medicationReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.medicationCodeableConcept, CodingKeys.medicationReference], debugDescription: "Must have at least one value for \"medication\" but have none")) + } + + // Decode all our properties + self.authoredOn = try FHIRPrimitive(from: _container, forKeyIfPresent: .authoredOn, auxiliaryKey: ._authoredOn) + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.definition = try [Reference](from: _container, forKeyIfPresent: .definition) + self.detectedIssue = try [Reference](from: _container, forKeyIfPresent: .detectedIssue) + self.dispenseRequest = try MedicationRequestDispenseRequest(from: _container, forKeyIfPresent: .dispenseRequest) + self.dosageInstruction = try [Dosage](from: _container, forKeyIfPresent: .dosageInstruction) + self.eventHistory = try [Reference](from: _container, forKeyIfPresent: .eventHistory) + self.groupIdentifier = try Identifier(from: _container, forKeyIfPresent: .groupIdentifier) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.intent = try FHIRPrimitive(from: _container, forKey: .intent, auxiliaryKey: ._intent) + var _t_medication: MedicationX? = nil + if let medicationCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .medicationCodeableConcept) { + if _t_medication != nil { + throw DecodingError.dataCorruptedError(forKey: .medicationCodeableConcept, in: _container, debugDescription: "More than one value provided for \"medication\"") + } + _t_medication = .codeableConcept(medicationCodeableConcept) + } + if let medicationReference = try Reference(from: _container, forKeyIfPresent: .medicationReference) { + if _t_medication != nil { + throw DecodingError.dataCorruptedError(forKey: .medicationReference, in: _container, debugDescription: "More than one value provided for \"medication\"") + } + _t_medication = .reference(medicationReference) + } + self.medication = _t_medication! + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.priorPrescription = try Reference(from: _container, forKeyIfPresent: .priorPrescription) + self.priority = try FHIRPrimitive(from: _container, forKeyIfPresent: .priority, auxiliaryKey: ._priority) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.recorder = try Reference(from: _container, forKeyIfPresent: .recorder) + self.requester = try MedicationRequestRequester(from: _container, forKeyIfPresent: .requester) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.substitution = try MedicationRequestSubstitution(from: _container, forKeyIfPresent: .substitution) + self.supportingInformation = try [Reference](from: _container, forKeyIfPresent: .supportingInformation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authoredOn?.encode(on: &_container, forKey: .authoredOn, auxiliaryKey: ._authoredOn) + try basedOn?.encode(on: &_container, forKey: .basedOn) + try category?.encode(on: &_container, forKey: .category) + try context?.encode(on: &_container, forKey: .context) + try definition?.encode(on: &_container, forKey: .definition) + try detectedIssue?.encode(on: &_container, forKey: .detectedIssue) + try dispenseRequest?.encode(on: &_container, forKey: .dispenseRequest) + try dosageInstruction?.encode(on: &_container, forKey: .dosageInstruction) + try eventHistory?.encode(on: &_container, forKey: .eventHistory) + try groupIdentifier?.encode(on: &_container, forKey: .groupIdentifier) + try identifier?.encode(on: &_container, forKey: .identifier) + try intent.encode(on: &_container, forKey: .intent, auxiliaryKey: ._intent) + + switch medication { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .medicationCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .medicationReference) + } + + try note?.encode(on: &_container, forKey: .note) + try priorPrescription?.encode(on: &_container, forKey: .priorPrescription) + try priority?.encode(on: &_container, forKey: .priority, auxiliaryKey: ._priority) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try recorder?.encode(on: &_container, forKey: .recorder) + try requester?.encode(on: &_container, forKey: .requester) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try substitution?.encode(on: &_container, forKey: .substitution) + try supportingInformation?.encode(on: &_container, forKey: .supportingInformation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authoredOn == _other.authoredOn + && basedOn == _other.basedOn + && category == _other.category + && context == _other.context + && definition == _other.definition + && detectedIssue == _other.detectedIssue + && dispenseRequest == _other.dispenseRequest + && dosageInstruction == _other.dosageInstruction + && eventHistory == _other.eventHistory + && groupIdentifier == _other.groupIdentifier + && identifier == _other.identifier + && intent == _other.intent + && medication == _other.medication + && note == _other.note + && priorPrescription == _other.priorPrescription + && priority == _other.priority + && reasonCode == _other.reasonCode + && reasonReference == _other.reasonReference + && recorder == _other.recorder + && requester == _other.requester + && status == _other.status + && subject == _other.subject + && substitution == _other.substitution + && supportingInformation == _other.supportingInformation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authoredOn) + hasher.combine(basedOn) + hasher.combine(category) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(detectedIssue) + hasher.combine(dispenseRequest) + hasher.combine(dosageInstruction) + hasher.combine(eventHistory) + hasher.combine(groupIdentifier) + hasher.combine(identifier) + hasher.combine(intent) + hasher.combine(medication) + hasher.combine(note) + hasher.combine(priorPrescription) + hasher.combine(priority) + hasher.combine(reasonCode) + hasher.combine(reasonReference) + hasher.combine(recorder) + hasher.combine(requester) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(substitution) + hasher.combine(supportingInformation) + } +} + +/** + Medication supply authorization. + + Indicates the specific details for the dispense or medication supply part of a medication request (also known as a + Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may + be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the + pharmacy department. + */ +open class MedicationRequestDispenseRequest: BackboneElement { + + /// Time period supply is authorized for + public var validityPeriod: Period? + + /// Number of refills authorized + public var numberOfRepeatsAllowed: FHIRPrimitive? + + /// Amount of medication to supply per dispense + public var quantity: Quantity? + + /// Number of days supply per dispense + public var expectedSupplyDuration: Duration? + + /// Intended dispenser + public var performer: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + expectedSupplyDuration: Duration? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + numberOfRepeatsAllowed: FHIRPrimitive? = nil, + performer: Reference? = nil, + quantity: Quantity? = nil, + validityPeriod: Period? = nil) + { + self.init() + self.expectedSupplyDuration = expectedSupplyDuration + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.numberOfRepeatsAllowed = numberOfRepeatsAllowed + self.performer = performer + self.quantity = quantity + self.validityPeriod = validityPeriod + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case expectedSupplyDuration + case numberOfRepeatsAllowed; case _numberOfRepeatsAllowed + case performer + case quantity + case validityPeriod + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.expectedSupplyDuration = try Duration(from: _container, forKeyIfPresent: .expectedSupplyDuration) + self.numberOfRepeatsAllowed = try FHIRPrimitive(from: _container, forKeyIfPresent: .numberOfRepeatsAllowed, auxiliaryKey: ._numberOfRepeatsAllowed) + self.performer = try Reference(from: _container, forKeyIfPresent: .performer) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.validityPeriod = try Period(from: _container, forKeyIfPresent: .validityPeriod) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try expectedSupplyDuration?.encode(on: &_container, forKey: .expectedSupplyDuration) + try numberOfRepeatsAllowed?.encode(on: &_container, forKey: .numberOfRepeatsAllowed, auxiliaryKey: ._numberOfRepeatsAllowed) + try performer?.encode(on: &_container, forKey: .performer) + try quantity?.encode(on: &_container, forKey: .quantity) + try validityPeriod?.encode(on: &_container, forKey: .validityPeriod) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationRequestDispenseRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return expectedSupplyDuration == _other.expectedSupplyDuration + && numberOfRepeatsAllowed == _other.numberOfRepeatsAllowed + && performer == _other.performer + && quantity == _other.quantity + && validityPeriod == _other.validityPeriod + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(expectedSupplyDuration) + hasher.combine(numberOfRepeatsAllowed) + hasher.combine(performer) + hasher.combine(quantity) + hasher.combine(validityPeriod) + } +} + +/** + Who/What requested the Request. + + The individual, organization or device that initiated the request and has responsibility for its activation. + */ +open class MedicationRequestRequester: BackboneElement { + + /// Who ordered the initial medication(s) + public var agent: Reference + + /// Organization agent is acting for + public var onBehalfOf: Reference? + + /// Designated initializer taking all required properties + public init(agent: Reference) { + self.agent = agent + super.init() + } + + /// Convenience initializer + public convenience init( + agent: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil) + { + self.init(agent: agent) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case agent + case onBehalfOf + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.agent = try Reference(from: _container, forKey: .agent) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try agent.encode(on: &_container, forKey: .agent) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationRequestRequester else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return agent == _other.agent + && onBehalfOf == _other.onBehalfOf + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(agent) + hasher.combine(onBehalfOf) + } +} + +/** + Any restrictions on medication substitution. + + Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in + other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified + substitution may be done. + */ +open class MedicationRequestSubstitution: BackboneElement { + + /// Whether substitution is allowed or not + public var allowed: FHIRPrimitive + + /// Why should (not) substitution be made + public var reason: CodeableConcept? + + /// Designated initializer taking all required properties + public init(allowed: FHIRPrimitive) { + self.allowed = allowed + super.init() + } + + /// Convenience initializer + public convenience init( + allowed: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + reason: CodeableConcept? = nil) + { + self.init(allowed: allowed) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.reason = reason + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case allowed; case _allowed + case reason + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.allowed = try FHIRPrimitive(from: _container, forKey: .allowed, auxiliaryKey: ._allowed) + self.reason = try CodeableConcept(from: _container, forKeyIfPresent: .reason) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try allowed.encode(on: &_container, forKey: .allowed, auxiliaryKey: ._allowed) + try reason?.encode(on: &_container, forKey: .reason) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationRequestSubstitution else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return allowed == _other.allowed + && reason == _other.reason + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(allowed) + hasher.combine(reason) + } +} diff --git a/Sources/ModelsSTU3/MedicationStatement.swift b/Sources/ModelsSTU3/MedicationStatement.swift new file mode 100644 index 0000000..dca7202 --- /dev/null +++ b/Sources/ModelsSTU3/MedicationStatement.swift @@ -0,0 +1,349 @@ +// +// MedicationStatement.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MedicationStatement) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Record of medication being taken by a patient. + + A record of a medication that is being consumed by a patient. A MedicationStatement may indicate that the patient may + be taking the medication now, or has taken the medication in the past or will be taking the medication in the future. + The source of this information can be the patient, significant other (such as a family member or spouse), or a + clinician. A common scenario where this information is captured is during the history taking process during a patient + visit or stay. The medication information may come from sources such as the patient's memory, from a prescription + bottle, or from a list of medications the patient, clinician or other party maintains + + The primary difference between a medication statement and a medication administration is that the medication + administration has complete administration information and is based on actual administration information from the + person who administered the medication. A medication statement is often, if not always, less specific. There is no + required date/time when the medication was administered, in fact we only know that a source has reported the patient is + taking this medication, where details such as time, quantity, or rate or even medication product may be incomplete or + missing or less precise. As stated earlier, the medication statement information may come from the patient's memory, + from a prescription bottle or from a list of medications the patient, clinician or other party maintains. Medication + administration is more formal and is not missing detailed information. + */ +open class MedicationStatement: DomainResource { + + override open class var resourceType: ResourceType { return .medicationStatement } + + /// All possible types for "effective[x]" + public enum EffectiveX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// All possible types for "medication[x]" + public enum MedicationX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// External identifier + public var identifier: [Identifier]? + + /// Fulfils plan, proposal or order + public var basedOn: [Reference]? + + /// Part of referenced event + public var partOf: [Reference]? + + /// Encounter / Episode associated with MedicationStatement + public var context: Reference? + + /// A code representing the patient or other source's judgment about the state of the medication used that this + /// statement is about. Generally this will be active or completed. + public var status: FHIRPrimitive + + /// Type of medication usage + public var category: CodeableConcept? + + /// What medication was taken + /// One of `medication[x]` + public var medication: MedicationX + + /// The date/time or interval when the medication was taken + /// One of `effective[x]` + public var effective: EffectiveX? + + /// When the statement was asserted? + public var dateAsserted: FHIRPrimitive? + + /// Person or organization that provided the information about the taking of this medication + public var informationSource: Reference? + + /// Who is/was taking the medication + public var subject: Reference + + /// Additional supporting information + public var derivedFrom: [Reference]? + + /// Indicator of the certainty of whether the medication was taken by the patient. + public var taken: FHIRPrimitive + + /// True if asserting medication was not given + public var reasonNotTaken: [CodeableConcept]? + + /// Reason for why the medication is being/was taken + public var reasonCode: [CodeableConcept]? + + /// Condition or observation that supports why the medication is being/was taken + public var reasonReference: [Reference]? + + /// Further information about the statement + public var note: [Annotation]? + + /// Details of how medication is/was taken or should be taken + public var dosage: [Dosage]? + + /// Designated initializer taking all required properties + public init(medication: MedicationX, status: FHIRPrimitive, subject: Reference, taken: FHIRPrimitive) { + self.medication = medication + self.status = status + self.subject = subject + self.taken = taken + super.init() + } + + /// Convenience initializer + public convenience init( + basedOn: [Reference]? = nil, + category: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + dateAsserted: FHIRPrimitive? = nil, + derivedFrom: [Reference]? = nil, + dosage: [Dosage]? = nil, + effective: EffectiveX? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + informationSource: Reference? = nil, + language: FHIRPrimitive? = nil, + medication: MedicationX, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + partOf: [Reference]? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonNotTaken: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + status: FHIRPrimitive, + subject: Reference, + taken: FHIRPrimitive, + text: Narrative? = nil) + { + self.init(medication: medication, status: status, subject: subject, taken: taken) + self.basedOn = basedOn + self.category = category + self.contained = contained + self.context = context + self.dateAsserted = dateAsserted + self.derivedFrom = derivedFrom + self.dosage = dosage + self.effective = effective + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.informationSource = informationSource + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.partOf = partOf + self.reasonCode = reasonCode + self.reasonNotTaken = reasonNotTaken + self.reasonReference = reasonReference + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case basedOn + case category + case context + case dateAsserted; case _dateAsserted + case derivedFrom + case dosage + case effectiveDateTime; case _effectiveDateTime + case effectivePeriod + case identifier + case informationSource + case medicationCodeableConcept + case medicationReference + case note + case partOf + case reasonCode + case reasonNotTaken + case reasonReference + case status; case _status + case subject + case taken; case _taken + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.medicationCodeableConcept) || _container.contains(CodingKeys.medicationReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.medicationCodeableConcept, CodingKeys.medicationReference], debugDescription: "Must have at least one value for \"medication\" but have none")) + } + + // Decode all our properties + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.dateAsserted = try FHIRPrimitive(from: _container, forKeyIfPresent: .dateAsserted, auxiliaryKey: ._dateAsserted) + self.derivedFrom = try [Reference](from: _container, forKeyIfPresent: .derivedFrom) + self.dosage = try [Dosage](from: _container, forKeyIfPresent: .dosage) + var _t_effective: EffectiveX? = nil + if let effectiveDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .effectiveDateTime, auxiliaryKey: ._effectiveDateTime) { + if _t_effective != nil { + throw DecodingError.dataCorruptedError(forKey: .effectiveDateTime, in: _container, debugDescription: "More than one value provided for \"effective\"") + } + _t_effective = .dateTime(effectiveDateTime) + } + if let effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) { + if _t_effective != nil { + throw DecodingError.dataCorruptedError(forKey: .effectivePeriod, in: _container, debugDescription: "More than one value provided for \"effective\"") + } + _t_effective = .period(effectivePeriod) + } + self.effective = _t_effective + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.informationSource = try Reference(from: _container, forKeyIfPresent: .informationSource) + var _t_medication: MedicationX? = nil + if let medicationCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .medicationCodeableConcept) { + if _t_medication != nil { + throw DecodingError.dataCorruptedError(forKey: .medicationCodeableConcept, in: _container, debugDescription: "More than one value provided for \"medication\"") + } + _t_medication = .codeableConcept(medicationCodeableConcept) + } + if let medicationReference = try Reference(from: _container, forKeyIfPresent: .medicationReference) { + if _t_medication != nil { + throw DecodingError.dataCorruptedError(forKey: .medicationReference, in: _container, debugDescription: "More than one value provided for \"medication\"") + } + _t_medication = .reference(medicationReference) + } + self.medication = _t_medication! + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.partOf = try [Reference](from: _container, forKeyIfPresent: .partOf) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonNotTaken = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonNotTaken) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.taken = try FHIRPrimitive(from: _container, forKey: .taken, auxiliaryKey: ._taken) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try basedOn?.encode(on: &_container, forKey: .basedOn) + try category?.encode(on: &_container, forKey: .category) + try context?.encode(on: &_container, forKey: .context) + try dateAsserted?.encode(on: &_container, forKey: .dateAsserted, auxiliaryKey: ._dateAsserted) + try derivedFrom?.encode(on: &_container, forKey: .derivedFrom) + try dosage?.encode(on: &_container, forKey: .dosage) + if let _enum = effective { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .effectiveDateTime, auxiliaryKey: ._effectiveDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .effectivePeriod) + } + } + try identifier?.encode(on: &_container, forKey: .identifier) + try informationSource?.encode(on: &_container, forKey: .informationSource) + + switch medication { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .medicationCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .medicationReference) + } + + try note?.encode(on: &_container, forKey: .note) + try partOf?.encode(on: &_container, forKey: .partOf) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonNotTaken?.encode(on: &_container, forKey: .reasonNotTaken) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try taken.encode(on: &_container, forKey: .taken, auxiliaryKey: ._taken) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MedicationStatement else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return basedOn == _other.basedOn + && category == _other.category + && context == _other.context + && dateAsserted == _other.dateAsserted + && derivedFrom == _other.derivedFrom + && dosage == _other.dosage + && effective == _other.effective + && identifier == _other.identifier + && informationSource == _other.informationSource + && medication == _other.medication + && note == _other.note + && partOf == _other.partOf + && reasonCode == _other.reasonCode + && reasonNotTaken == _other.reasonNotTaken + && reasonReference == _other.reasonReference + && status == _other.status + && subject == _other.subject + && taken == _other.taken + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(basedOn) + hasher.combine(category) + hasher.combine(context) + hasher.combine(dateAsserted) + hasher.combine(derivedFrom) + hasher.combine(dosage) + hasher.combine(effective) + hasher.combine(identifier) + hasher.combine(informationSource) + hasher.combine(medication) + hasher.combine(note) + hasher.combine(partOf) + hasher.combine(reasonCode) + hasher.combine(reasonNotTaken) + hasher.combine(reasonReference) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(taken) + } +} diff --git a/Sources/ModelsSTU3/MessageDefinition.swift b/Sources/ModelsSTU3/MessageDefinition.swift new file mode 100644 index 0000000..01f8be3 --- /dev/null +++ b/Sources/ModelsSTU3/MessageDefinition.swift @@ -0,0 +1,507 @@ +// +// MessageDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MessageDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A resource that defines a type of message that can be exchanged between systems. + + Defines the characteristics of a message that can be shared between systems, including the type of event that initiates + the message, the content to be transmitted and what response(s), if any, are permitted. + */ +open class MessageDefinition: DomainResource { + + override open class var resourceType: ResourceType { return .messageDefinition } + + /// Logical URI to reference this message definition (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the message definition + public var identifier: Identifier? + + /// Business version of the message definition + public var version: FHIRPrimitive? + + /// Name for this message definition (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this message definition (human friendly) + public var title: FHIRPrimitive? + + /// The status of this message definition. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the message definition + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for message definition (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Why this message definition is defined + public var purpose: FHIRPrimitive? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Definition this one is based on + public var base: Reference? + + /// Protocol/workflow this is part of + public var parent: [Reference]? + + /// Takes the place of + public var replaces: [Reference]? + + /// Event type + public var event: Coding + + /// The impact of the content of the message. + public var category: FHIRPrimitive? + + /// Resource(s) that are the subject of the event + public var focus: [MessageDefinitionFocus]? + + /// Is a response required? + public var responseRequired: FHIRPrimitive? + + /// Responses to this message + public var allowedResponse: [MessageDefinitionAllowedResponse]? + + /// Designated initializer taking all required properties + public init(date: FHIRPrimitive, event: Coding, status: FHIRPrimitive) { + self.date = date + self.event = event + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + allowedResponse: [MessageDefinitionAllowedResponse]? = nil, + base: Reference? = nil, + category: FHIRPrimitive? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive, + description_fhir: FHIRPrimitive? = nil, + event: Coding, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + focus: [MessageDefinitionFocus]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + parent: [Reference]? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + replaces: [Reference]? = nil, + responseRequired: FHIRPrimitive? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(date: date, event: event, status: status) + self.allowedResponse = allowedResponse + self.base = base + self.category = category + self.contact = contact + self.contained = contained + self.copyright = copyright + self.description_fhir = description_fhir + self.experimental = experimental + self.`extension` = `extension` + self.focus = focus + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.parent = parent + self.publisher = publisher + self.purpose = purpose + self.replaces = replaces + self.responseRequired = responseRequired + self.text = text + self.title = title + self.url = url + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case allowedResponse + case base + case category; case _category + case contact + case copyright; case _copyright + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case event + case experimental; case _experimental + case focus + case identifier + case jurisdiction + case name; case _name + case parent + case publisher; case _publisher + case purpose; case _purpose + case replaces + case responseRequired; case _responseRequired + case status; case _status + case title; case _title + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.allowedResponse = try [MessageDefinitionAllowedResponse](from: _container, forKeyIfPresent: .allowedResponse) + self.base = try Reference(from: _container, forKeyIfPresent: .base) + self.category = try FHIRPrimitive(from: _container, forKeyIfPresent: .category, auxiliaryKey: ._category) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKey: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.event = try Coding(from: _container, forKey: .event) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.focus = try [MessageDefinitionFocus](from: _container, forKeyIfPresent: .focus) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.parent = try [Reference](from: _container, forKeyIfPresent: .parent) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.replaces = try [Reference](from: _container, forKeyIfPresent: .replaces) + self.responseRequired = try FHIRPrimitive(from: _container, forKeyIfPresent: .responseRequired, auxiliaryKey: ._responseRequired) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try allowedResponse?.encode(on: &_container, forKey: .allowedResponse) + try base?.encode(on: &_container, forKey: .base) + try category?.encode(on: &_container, forKey: .category, auxiliaryKey: ._category) + try contact?.encode(on: &_container, forKey: .contact) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try event.encode(on: &_container, forKey: .event) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try focus?.encode(on: &_container, forKey: .focus) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try parent?.encode(on: &_container, forKey: .parent) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try replaces?.encode(on: &_container, forKey: .replaces) + try responseRequired?.encode(on: &_container, forKey: .responseRequired, auxiliaryKey: ._responseRequired) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MessageDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return allowedResponse == _other.allowedResponse + && base == _other.base + && category == _other.category + && contact == _other.contact + && copyright == _other.copyright + && date == _other.date + && description_fhir == _other.description_fhir + && event == _other.event + && experimental == _other.experimental + && focus == _other.focus + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && name == _other.name + && parent == _other.parent + && publisher == _other.publisher + && purpose == _other.purpose + && replaces == _other.replaces + && responseRequired == _other.responseRequired + && status == _other.status + && title == _other.title + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(allowedResponse) + hasher.combine(base) + hasher.combine(category) + hasher.combine(contact) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(event) + hasher.combine(experimental) + hasher.combine(focus) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(name) + hasher.combine(parent) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(replaces) + hasher.combine(responseRequired) + hasher.combine(status) + hasher.combine(title) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Responses to this message. + + Indicates what types of messages may be sent as an application-level response to this message. + */ +open class MessageDefinitionAllowedResponse: BackboneElement { + + /// Reference to allowed message definition response + public var message: Reference + + /// When should this response be used + public var situation: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(message: Reference) { + self.message = message + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + message: Reference, + modifierExtension: [Extension]? = nil, + situation: FHIRPrimitive? = nil) + { + self.init(message: message) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.situation = situation + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case message + case situation; case _situation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.message = try Reference(from: _container, forKey: .message) + self.situation = try FHIRPrimitive(from: _container, forKeyIfPresent: .situation, auxiliaryKey: ._situation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try message.encode(on: &_container, forKey: .message) + try situation?.encode(on: &_container, forKey: .situation, auxiliaryKey: ._situation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MessageDefinitionAllowedResponse else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return message == _other.message + && situation == _other.situation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(message) + hasher.combine(situation) + } +} + +/** + Resource(s) that are the subject of the event. + + Identifies the resource (or resources) that are being addressed by the event. For example, the Encounter for an admit + message or two Account records for a merge. + */ +open class MessageDefinitionFocus: BackboneElement { + + /// The kind of resource that must be the focus for this message. + public var code: FHIRPrimitive + + /// Profile that must be adhered to by focus + public var profile: Reference? + + /// Minimum number of focuses of this type + public var min: FHIRPrimitive? + + /// Maximum number of focuses of this type + public var max: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + max: FHIRPrimitive? = nil, + min: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + profile: Reference? = nil) + { + self.init(code: code) + self.`extension` = `extension` + self.id = id + self.max = max + self.min = min + self.modifierExtension = modifierExtension + self.profile = profile + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case max; case _max + case min; case _min + case profile + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.max = try FHIRPrimitive(from: _container, forKeyIfPresent: .max, auxiliaryKey: ._max) + self.min = try FHIRPrimitive(from: _container, forKeyIfPresent: .min, auxiliaryKey: ._min) + self.profile = try Reference(from: _container, forKeyIfPresent: .profile) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try max?.encode(on: &_container, forKey: .max, auxiliaryKey: ._max) + try min?.encode(on: &_container, forKey: .min, auxiliaryKey: ._min) + try profile?.encode(on: &_container, forKey: .profile) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MessageDefinitionFocus else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && max == _other.max + && min == _other.min + && profile == _other.profile + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(max) + hasher.combine(min) + hasher.combine(profile) + } +} diff --git a/Sources/ModelsSTU3/MessageHeader.swift b/Sources/ModelsSTU3/MessageHeader.swift new file mode 100644 index 0000000..cd26fba --- /dev/null +++ b/Sources/ModelsSTU3/MessageHeader.swift @@ -0,0 +1,509 @@ +// +// MessageHeader.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/MessageHeader) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A resource that describes a message that is exchanged between systems. + + The header for a message exchange that is either requesting or responding to an action. The reference(s) that are the + subject of the action as well as other information related to the action are typically transmitted in a bundle in which + the MessageHeader resource instance is the first resource in the bundle. + */ +open class MessageHeader: DomainResource { + + override open class var resourceType: ResourceType { return .messageHeader } + + /// Code for the event this message represents + public var event: Coding + + /// Message destination application(s) + public var destination: [MessageHeaderDestination]? + + /// Intended "real-world" recipient for the data + public var receiver: Reference? + + /// Real world sender of the message + public var sender: Reference? + + /// Time that the message was sent + public var timestamp: FHIRPrimitive + + /// The source of the data entry + public var enterer: Reference? + + /// The source of the decision + public var author: Reference? + + /// Message source application + public var source: MessageHeaderSource + + /// Final responsibility for event + public var responsible: Reference? + + /// Cause of event + public var reason: CodeableConcept? + + /// If this is a reply to prior message + public var response: MessageHeaderResponse? + + /// The actual content of the message + public var focus: [Reference]? + + /// Designated initializer taking all required properties + public init(event: Coding, source: MessageHeaderSource, timestamp: FHIRPrimitive) { + self.event = event + self.source = source + self.timestamp = timestamp + super.init() + } + + /// Convenience initializer + public convenience init( + author: Reference? = nil, + contained: [ResourceProxy]? = nil, + destination: [MessageHeaderDestination]? = nil, + enterer: Reference? = nil, + event: Coding, + `extension`: [Extension]? = nil, + focus: [Reference]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + reason: CodeableConcept? = nil, + receiver: Reference? = nil, + response: MessageHeaderResponse? = nil, + responsible: Reference? = nil, + sender: Reference? = nil, + source: MessageHeaderSource, + text: Narrative? = nil, + timestamp: FHIRPrimitive) + { + self.init(event: event, source: source, timestamp: timestamp) + self.author = author + self.contained = contained + self.destination = destination + self.enterer = enterer + self.`extension` = `extension` + self.focus = focus + self.id = id + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.reason = reason + self.receiver = receiver + self.response = response + self.responsible = responsible + self.sender = sender + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case author + case destination + case enterer + case event + case focus + case reason + case receiver + case response + case responsible + case sender + case source + case timestamp; case _timestamp + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.author = try Reference(from: _container, forKeyIfPresent: .author) + self.destination = try [MessageHeaderDestination](from: _container, forKeyIfPresent: .destination) + self.enterer = try Reference(from: _container, forKeyIfPresent: .enterer) + self.event = try Coding(from: _container, forKey: .event) + self.focus = try [Reference](from: _container, forKeyIfPresent: .focus) + self.reason = try CodeableConcept(from: _container, forKeyIfPresent: .reason) + self.receiver = try Reference(from: _container, forKeyIfPresent: .receiver) + self.response = try MessageHeaderResponse(from: _container, forKeyIfPresent: .response) + self.responsible = try Reference(from: _container, forKeyIfPresent: .responsible) + self.sender = try Reference(from: _container, forKeyIfPresent: .sender) + self.source = try MessageHeaderSource(from: _container, forKey: .source) + self.timestamp = try FHIRPrimitive(from: _container, forKey: .timestamp, auxiliaryKey: ._timestamp) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try author?.encode(on: &_container, forKey: .author) + try destination?.encode(on: &_container, forKey: .destination) + try enterer?.encode(on: &_container, forKey: .enterer) + try event.encode(on: &_container, forKey: .event) + try focus?.encode(on: &_container, forKey: .focus) + try reason?.encode(on: &_container, forKey: .reason) + try receiver?.encode(on: &_container, forKey: .receiver) + try response?.encode(on: &_container, forKey: .response) + try responsible?.encode(on: &_container, forKey: .responsible) + try sender?.encode(on: &_container, forKey: .sender) + try source.encode(on: &_container, forKey: .source) + try timestamp.encode(on: &_container, forKey: .timestamp, auxiliaryKey: ._timestamp) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MessageHeader else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return author == _other.author + && destination == _other.destination + && enterer == _other.enterer + && event == _other.event + && focus == _other.focus + && reason == _other.reason + && receiver == _other.receiver + && response == _other.response + && responsible == _other.responsible + && sender == _other.sender + && source == _other.source + && timestamp == _other.timestamp + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(author) + hasher.combine(destination) + hasher.combine(enterer) + hasher.combine(event) + hasher.combine(focus) + hasher.combine(reason) + hasher.combine(receiver) + hasher.combine(response) + hasher.combine(responsible) + hasher.combine(sender) + hasher.combine(source) + hasher.combine(timestamp) + } +} + +/** + Message destination application(s). + + The destination application which the message is intended for. + */ +open class MessageHeaderDestination: BackboneElement { + + /// Name of system + public var name: FHIRPrimitive? + + /// Particular delivery destination within the destination + public var target: Reference? + + /// Actual destination address or id + public var endpoint: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(endpoint: FHIRPrimitive) { + self.endpoint = endpoint + super.init() + } + + /// Convenience initializer + public convenience init( + endpoint: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + target: Reference? = nil) + { + self.init(endpoint: endpoint) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.name = name + self.target = target + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case endpoint; case _endpoint + case name; case _name + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.endpoint = try FHIRPrimitive(from: _container, forKey: .endpoint, auxiliaryKey: ._endpoint) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.target = try Reference(from: _container, forKeyIfPresent: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try endpoint.encode(on: &_container, forKey: .endpoint, auxiliaryKey: ._endpoint) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try target?.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MessageHeaderDestination else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return endpoint == _other.endpoint + && name == _other.name + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(endpoint) + hasher.combine(name) + hasher.combine(target) + } +} + +/** + If this is a reply to prior message. + + Information about the message that this message is a response to. Only present if this message is a response. + */ +open class MessageHeaderResponse: BackboneElement { + + /// Id of original message + public var identifier: FHIRPrimitive + + /// Code that identifies the type of response to the message - whether it was successful or not, and whether it + /// should be resent or not. + public var code: FHIRPrimitive + + /// Specific list of hints/warnings/errors + public var details: Reference? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, identifier: FHIRPrimitive) { + self.code = code + self.identifier = identifier + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + details: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: FHIRPrimitive, + modifierExtension: [Extension]? = nil) + { + self.init(code: code, identifier: identifier) + self.details = details + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case details + case identifier; case _identifier + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.details = try Reference(from: _container, forKeyIfPresent: .details) + self.identifier = try FHIRPrimitive(from: _container, forKey: .identifier, auxiliaryKey: ._identifier) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try details?.encode(on: &_container, forKey: .details) + try identifier.encode(on: &_container, forKey: .identifier, auxiliaryKey: ._identifier) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MessageHeaderResponse else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && details == _other.details + && identifier == _other.identifier + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(details) + hasher.combine(identifier) + } +} + +/** + Message source application. + + The source application from which this message originated. + */ +open class MessageHeaderSource: BackboneElement { + + /// Name of system + public var name: FHIRPrimitive? + + /// Name of software running the system + public var software: FHIRPrimitive? + + /// Version of software running + public var version: FHIRPrimitive? + + /// Human contact for problems + public var contact: ContactPoint? + + /// Actual message source address or id + public var endpoint: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(endpoint: FHIRPrimitive) { + self.endpoint = endpoint + super.init() + } + + /// Convenience initializer + public convenience init( + contact: ContactPoint? = nil, + endpoint: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + software: FHIRPrimitive? = nil, + version: FHIRPrimitive? = nil) + { + self.init(endpoint: endpoint) + self.contact = contact + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.name = name + self.software = software + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contact + case endpoint; case _endpoint + case name; case _name + case software; case _software + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contact = try ContactPoint(from: _container, forKeyIfPresent: .contact) + self.endpoint = try FHIRPrimitive(from: _container, forKey: .endpoint, auxiliaryKey: ._endpoint) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.software = try FHIRPrimitive(from: _container, forKeyIfPresent: .software, auxiliaryKey: ._software) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contact?.encode(on: &_container, forKey: .contact) + try endpoint.encode(on: &_container, forKey: .endpoint, auxiliaryKey: ._endpoint) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try software?.encode(on: &_container, forKey: .software, auxiliaryKey: ._software) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? MessageHeaderSource else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contact == _other.contact + && endpoint == _other.endpoint + && name == _other.name + && software == _other.software + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contact) + hasher.combine(endpoint) + hasher.combine(name) + hasher.combine(software) + hasher.combine(version) + } +} diff --git a/Sources/ModelsSTU3/Meta.swift b/Sources/ModelsSTU3/Meta.swift new file mode 100644 index 0000000..931f27b --- /dev/null +++ b/Sources/ModelsSTU3/Meta.swift @@ -0,0 +1,130 @@ +// +// Meta.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Meta) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Metadata about a resource. + + The metadata about a resource. This is content in the resource that is maintained by the infrastructure. Changes to the + content may not always be associated with version changes to the resource. + */ +open class Meta: Element { + + /// Version specific identifier + public var versionId: FHIRPrimitive? + + /// When the resource version last changed + public var lastUpdated: FHIRPrimitive? + + /// Profiles this resource claims to conform to + public var profile: [FHIRPrimitive]? + + /// Security Labels applied to this resource + public var security: [Coding]? + + /// Tags applied to this resource + public var tag: [Coding]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + lastUpdated: FHIRPrimitive? = nil, + profile: [FHIRPrimitive]? = nil, + security: [Coding]? = nil, + tag: [Coding]? = nil, + versionId: FHIRPrimitive? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.lastUpdated = lastUpdated + self.profile = profile + self.security = security + self.tag = tag + self.versionId = versionId + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case lastUpdated; case _lastUpdated + case profile; case _profile + case security + case tag + case versionId; case _versionId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.lastUpdated = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastUpdated, auxiliaryKey: ._lastUpdated) + self.profile = try [FHIRPrimitive](from: _container, forKeyIfPresent: .profile, auxiliaryKey: ._profile) + self.security = try [Coding](from: _container, forKeyIfPresent: .security) + self.tag = try [Coding](from: _container, forKeyIfPresent: .tag) + self.versionId = try FHIRPrimitive(from: _container, forKeyIfPresent: .versionId, auxiliaryKey: ._versionId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try lastUpdated?.encode(on: &_container, forKey: .lastUpdated, auxiliaryKey: ._lastUpdated) + try profile?.encode(on: &_container, forKey: .profile, auxiliaryKey: ._profile) + try security?.encode(on: &_container, forKey: .security) + try tag?.encode(on: &_container, forKey: .tag) + try versionId?.encode(on: &_container, forKey: .versionId, auxiliaryKey: ._versionId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Meta else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return lastUpdated == _other.lastUpdated + && profile == _other.profile + && security == _other.security + && tag == _other.tag + && versionId == _other.versionId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(lastUpdated) + hasher.combine(profile) + hasher.combine(security) + hasher.combine(tag) + hasher.combine(versionId) + } +} diff --git a/Sources/ModelsSTU3/Money.swift b/Sources/ModelsSTU3/Money.swift new file mode 100644 index 0000000..9a42c50 --- /dev/null +++ b/Sources/ModelsSTU3/Money.swift @@ -0,0 +1,79 @@ +// +// Money.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Money) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + An amount of economic utility in some recognized currency. + */ +open class Money: Quantity { + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive? = nil, + comparator: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + system: FHIRPrimitive? = nil, + unit: FHIRPrimitive? = nil, + value: FHIRPrimitive? = nil) + { + self.init() + self.code = code + self.comparator = comparator + self.`extension` = `extension` + self.id = id + self.system = system + self.unit = unit + self.value = value + } + + // MARK: - Codable + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Money else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return true + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + } +} diff --git a/Sources/ModelsSTU3/NamingSystem.swift b/Sources/ModelsSTU3/NamingSystem.swift new file mode 100644 index 0000000..3dfef10 --- /dev/null +++ b/Sources/ModelsSTU3/NamingSystem.swift @@ -0,0 +1,345 @@ +// +// NamingSystem.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/NamingSystem) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + System of unique identification. + + A curated namespace that issues unique symbols within that namespace for the identification of concepts, people, + devices, etc. Represents a "System" used within the Identifier and Coding data types. + */ +open class NamingSystem: DomainResource { + + override open class var resourceType: ResourceType { return .namingSystem } + + /// Name for this naming system (computer friendly) + public var name: FHIRPrimitive + + /// The status of this naming system. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// Indicates the purpose for the naming system - what kinds of things does it make unique? + public var kind: FHIRPrimitive + + /// Date this was last changed + public var date: FHIRPrimitive + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Who maintains system namespace? + public var responsible: FHIRPrimitive? + + /// e.g. driver, provider, patient, bank etc. + public var type: CodeableConcept? + + /// Natural language description of the naming system + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for naming system (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// How/where is it used + public var usage: FHIRPrimitive? + + /// Unique identifiers used for system + public var uniqueId: [NamingSystemUniqueId] + + /// Use this instead + public var replacedBy: Reference? + + /// Designated initializer taking all required properties + public init(date: FHIRPrimitive, kind: FHIRPrimitive, name: FHIRPrimitive, status: FHIRPrimitive, uniqueId: [NamingSystemUniqueId]) { + self.date = date + self.kind = kind + self.name = name + self.status = status + self.uniqueId = uniqueId + super.init() + } + + /// Convenience initializer + public convenience init( + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + kind: FHIRPrimitive, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + publisher: FHIRPrimitive? = nil, + replacedBy: Reference? = nil, + responsible: FHIRPrimitive? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + type: CodeableConcept? = nil, + uniqueId: [NamingSystemUniqueId], + usage: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil) + { + self.init(date: date, kind: kind, name: name, status: status, uniqueId: uniqueId) + self.contact = contact + self.contained = contained + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.publisher = publisher + self.replacedBy = replacedBy + self.responsible = responsible + self.text = text + self.type = type + self.usage = usage + self.useContext = useContext + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contact + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case jurisdiction + case kind; case _kind + case name; case _name + case publisher; case _publisher + case replacedBy + case responsible; case _responsible + case status; case _status + case type + case uniqueId + case usage; case _usage + case useContext + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.date = try FHIRPrimitive(from: _container, forKey: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.kind = try FHIRPrimitive(from: _container, forKey: .kind, auxiliaryKey: ._kind) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.replacedBy = try Reference(from: _container, forKeyIfPresent: .replacedBy) + self.responsible = try FHIRPrimitive(from: _container, forKeyIfPresent: .responsible, auxiliaryKey: ._responsible) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + self.uniqueId = try [NamingSystemUniqueId](from: _container, forKey: .uniqueId) + self.usage = try FHIRPrimitive(from: _container, forKeyIfPresent: .usage, auxiliaryKey: ._usage) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contact?.encode(on: &_container, forKey: .contact) + try date.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try kind.encode(on: &_container, forKey: .kind, auxiliaryKey: ._kind) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try replacedBy?.encode(on: &_container, forKey: .replacedBy) + try responsible?.encode(on: &_container, forKey: .responsible, auxiliaryKey: ._responsible) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try type?.encode(on: &_container, forKey: .type) + try uniqueId.encode(on: &_container, forKey: .uniqueId) + try usage?.encode(on: &_container, forKey: .usage, auxiliaryKey: ._usage) + try useContext?.encode(on: &_container, forKey: .useContext) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? NamingSystem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contact == _other.contact + && date == _other.date + && description_fhir == _other.description_fhir + && jurisdiction == _other.jurisdiction + && kind == _other.kind + && name == _other.name + && publisher == _other.publisher + && replacedBy == _other.replacedBy + && responsible == _other.responsible + && status == _other.status + && type == _other.type + && uniqueId == _other.uniqueId + && usage == _other.usage + && useContext == _other.useContext + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contact) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(jurisdiction) + hasher.combine(kind) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(replacedBy) + hasher.combine(responsible) + hasher.combine(status) + hasher.combine(type) + hasher.combine(uniqueId) + hasher.combine(usage) + hasher.combine(useContext) + } +} + +/** + Unique identifiers used for system. + + Indicates how the system may be identified when referenced in electronic exchange. + */ +open class NamingSystemUniqueId: BackboneElement { + + /// Identifies the unique identifier scheme used for this particular identifier. + public var type: FHIRPrimitive + + /// The unique identifier + public var value: FHIRPrimitive + + /// Is this the id that should be used for this type + public var preferred: FHIRPrimitive? + + /// Notes about identifier usage + public var comment: FHIRPrimitive? + + /// When is identifier valid? + public var period: Period? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive, value: FHIRPrimitive) { + self.type = type + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + comment: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil, + preferred: FHIRPrimitive? = nil, + type: FHIRPrimitive, + value: FHIRPrimitive) + { + self.init(type: type, value: value) + self.comment = comment + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.period = period + self.preferred = preferred + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case comment; case _comment + case period + case preferred; case _preferred + case type; case _type + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.preferred = try FHIRPrimitive(from: _container, forKeyIfPresent: .preferred, auxiliaryKey: ._preferred) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try period?.encode(on: &_container, forKey: .period) + try preferred?.encode(on: &_container, forKey: .preferred, auxiliaryKey: ._preferred) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? NamingSystemUniqueId else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return comment == _other.comment + && period == _other.period + && preferred == _other.preferred + && type == _other.type + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(comment) + hasher.combine(period) + hasher.combine(preferred) + hasher.combine(type) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/Narrative.swift b/Sources/ModelsSTU3/Narrative.swift new file mode 100644 index 0000000..535ef7e --- /dev/null +++ b/Sources/ModelsSTU3/Narrative.swift @@ -0,0 +1,98 @@ +// +// Narrative.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Narrative) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A human-readable formatted text, including images. + */ +open class Narrative: Element { + + /// The status of the narrative - whether it's entirely generated (from just the defined data or the extensions + /// too), or whether a human authored it and it may contain additional data. + public var status: FHIRPrimitive + + /// Limited xhtml content + public var div: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(div: FHIRPrimitive, status: FHIRPrimitive) { + self.div = div + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + div: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + status: FHIRPrimitive) + { + self.init(div: div, status: status) + self.`extension` = `extension` + self.id = id + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case div; case _div + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.div = try FHIRPrimitive(from: _container, forKey: .div, auxiliaryKey: ._div) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try div.encode(on: &_container, forKey: .div, auxiliaryKey: ._div) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Narrative else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return div == _other.div + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(div) + hasher.combine(status) + } +} diff --git a/Sources/ModelsSTU3/NutritionOrder.swift b/Sources/ModelsSTU3/NutritionOrder.swift new file mode 100644 index 0000000..a497524 --- /dev/null +++ b/Sources/ModelsSTU3/NutritionOrder.swift @@ -0,0 +1,881 @@ +// +// NutritionOrder.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/NutritionOrder) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Diet, formula or nutritional supplement request. + + A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident. + */ +open class NutritionOrder: DomainResource { + + override open class var resourceType: ResourceType { return .nutritionOrder } + + /// Identifiers assigned to this order + public var identifier: [Identifier]? + + /// The workflow status of the nutrition order/request. + public var status: FHIRPrimitive? + + /// The person who requires the diet, formula or nutritional supplement + public var patient: Reference + + /// The encounter associated with this nutrition order + public var encounter: Reference? + + /// Date and time the nutrition order was requested + public var dateTime: FHIRPrimitive + + /// Who ordered the diet, formula or nutritional supplement + public var orderer: Reference? + + /// List of the patient's food and nutrition-related allergies and intolerances + public var allergyIntolerance: [Reference]? + + /// Order-specific modifier about the type of food that should be given + public var foodPreferenceModifier: [CodeableConcept]? + + /// Order-specific modifier about the type of food that should not be given + public var excludeFoodModifier: [CodeableConcept]? + + /// Oral diet components + public var oralDiet: NutritionOrderOralDiet? + + /// Supplement components + public var supplement: [NutritionOrderSupplement]? + + /// Enteral formula components + public var enteralFormula: NutritionOrderEnteralFormula? + + /// Designated initializer taking all required properties + public init(dateTime: FHIRPrimitive, patient: Reference) { + self.dateTime = dateTime + self.patient = patient + super.init() + } + + /// Convenience initializer + public convenience init( + allergyIntolerance: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + dateTime: FHIRPrimitive, + encounter: Reference? = nil, + enteralFormula: NutritionOrderEnteralFormula? = nil, + excludeFoodModifier: [CodeableConcept]? = nil, + `extension`: [Extension]? = nil, + foodPreferenceModifier: [CodeableConcept]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + oralDiet: NutritionOrderOralDiet? = nil, + orderer: Reference? = nil, + patient: Reference, + status: FHIRPrimitive? = nil, + supplement: [NutritionOrderSupplement]? = nil, + text: Narrative? = nil) + { + self.init(dateTime: dateTime, patient: patient) + self.allergyIntolerance = allergyIntolerance + self.contained = contained + self.encounter = encounter + self.enteralFormula = enteralFormula + self.excludeFoodModifier = excludeFoodModifier + self.`extension` = `extension` + self.foodPreferenceModifier = foodPreferenceModifier + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.oralDiet = oralDiet + self.orderer = orderer + self.status = status + self.supplement = supplement + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case allergyIntolerance + case dateTime; case _dateTime + case encounter + case enteralFormula + case excludeFoodModifier + case foodPreferenceModifier + case identifier + case oralDiet + case orderer + case patient + case status; case _status + case supplement + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.allergyIntolerance = try [Reference](from: _container, forKeyIfPresent: .allergyIntolerance) + self.dateTime = try FHIRPrimitive(from: _container, forKey: .dateTime, auxiliaryKey: ._dateTime) + self.encounter = try Reference(from: _container, forKeyIfPresent: .encounter) + self.enteralFormula = try NutritionOrderEnteralFormula(from: _container, forKeyIfPresent: .enteralFormula) + self.excludeFoodModifier = try [CodeableConcept](from: _container, forKeyIfPresent: .excludeFoodModifier) + self.foodPreferenceModifier = try [CodeableConcept](from: _container, forKeyIfPresent: .foodPreferenceModifier) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.oralDiet = try NutritionOrderOralDiet(from: _container, forKeyIfPresent: .oralDiet) + self.orderer = try Reference(from: _container, forKeyIfPresent: .orderer) + self.patient = try Reference(from: _container, forKey: .patient) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.supplement = try [NutritionOrderSupplement](from: _container, forKeyIfPresent: .supplement) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try allergyIntolerance?.encode(on: &_container, forKey: .allergyIntolerance) + try dateTime.encode(on: &_container, forKey: .dateTime, auxiliaryKey: ._dateTime) + try encounter?.encode(on: &_container, forKey: .encounter) + try enteralFormula?.encode(on: &_container, forKey: .enteralFormula) + try excludeFoodModifier?.encode(on: &_container, forKey: .excludeFoodModifier) + try foodPreferenceModifier?.encode(on: &_container, forKey: .foodPreferenceModifier) + try identifier?.encode(on: &_container, forKey: .identifier) + try oralDiet?.encode(on: &_container, forKey: .oralDiet) + try orderer?.encode(on: &_container, forKey: .orderer) + try patient.encode(on: &_container, forKey: .patient) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try supplement?.encode(on: &_container, forKey: .supplement) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? NutritionOrder else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return allergyIntolerance == _other.allergyIntolerance + && dateTime == _other.dateTime + && encounter == _other.encounter + && enteralFormula == _other.enteralFormula + && excludeFoodModifier == _other.excludeFoodModifier + && foodPreferenceModifier == _other.foodPreferenceModifier + && identifier == _other.identifier + && oralDiet == _other.oralDiet + && orderer == _other.orderer + && patient == _other.patient + && status == _other.status + && supplement == _other.supplement + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(allergyIntolerance) + hasher.combine(dateTime) + hasher.combine(encounter) + hasher.combine(enteralFormula) + hasher.combine(excludeFoodModifier) + hasher.combine(foodPreferenceModifier) + hasher.combine(identifier) + hasher.combine(oralDiet) + hasher.combine(orderer) + hasher.combine(patient) + hasher.combine(status) + hasher.combine(supplement) + } +} + +/** + Enteral formula components. + + Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to + the oral cavity. + */ +open class NutritionOrderEnteralFormula: BackboneElement { + + /// Type of enteral or infant formula + public var baseFormulaType: CodeableConcept? + + /// Product or brand name of the enteral or infant formula + public var baseFormulaProductName: FHIRPrimitive? + + /// Type of modular component to add to the feeding + public var additiveType: CodeableConcept? + + /// Product or brand name of the modular additive + public var additiveProductName: FHIRPrimitive? + + /// Amount of energy per specified volume that is required + public var caloricDensity: Quantity? + + /// How the formula should enter the patient's gastrointestinal tract + public var routeofAdministration: CodeableConcept? + + /// Formula feeding instruction as structured data + public var administration: [NutritionOrderEnteralFormulaAdministration]? + + /// Upper limit on formula volume per unit of time + public var maxVolumeToDeliver: Quantity? + + /// Formula feeding instructions expressed as text + public var administrationInstruction: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + additiveProductName: FHIRPrimitive? = nil, + additiveType: CodeableConcept? = nil, + administration: [NutritionOrderEnteralFormulaAdministration]? = nil, + administrationInstruction: FHIRPrimitive? = nil, + baseFormulaProductName: FHIRPrimitive? = nil, + baseFormulaType: CodeableConcept? = nil, + caloricDensity: Quantity? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + maxVolumeToDeliver: Quantity? = nil, + modifierExtension: [Extension]? = nil, + routeofAdministration: CodeableConcept? = nil) + { + self.init() + self.additiveProductName = additiveProductName + self.additiveType = additiveType + self.administration = administration + self.administrationInstruction = administrationInstruction + self.baseFormulaProductName = baseFormulaProductName + self.baseFormulaType = baseFormulaType + self.caloricDensity = caloricDensity + self.`extension` = `extension` + self.id = id + self.maxVolumeToDeliver = maxVolumeToDeliver + self.modifierExtension = modifierExtension + self.routeofAdministration = routeofAdministration + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case additiveProductName; case _additiveProductName + case additiveType + case administration + case administrationInstruction; case _administrationInstruction + case baseFormulaProductName; case _baseFormulaProductName + case baseFormulaType + case caloricDensity + case maxVolumeToDeliver + case routeofAdministration + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.additiveProductName = try FHIRPrimitive(from: _container, forKeyIfPresent: .additiveProductName, auxiliaryKey: ._additiveProductName) + self.additiveType = try CodeableConcept(from: _container, forKeyIfPresent: .additiveType) + self.administration = try [NutritionOrderEnteralFormulaAdministration](from: _container, forKeyIfPresent: .administration) + self.administrationInstruction = try FHIRPrimitive(from: _container, forKeyIfPresent: .administrationInstruction, auxiliaryKey: ._administrationInstruction) + self.baseFormulaProductName = try FHIRPrimitive(from: _container, forKeyIfPresent: .baseFormulaProductName, auxiliaryKey: ._baseFormulaProductName) + self.baseFormulaType = try CodeableConcept(from: _container, forKeyIfPresent: .baseFormulaType) + self.caloricDensity = try Quantity(from: _container, forKeyIfPresent: .caloricDensity) + self.maxVolumeToDeliver = try Quantity(from: _container, forKeyIfPresent: .maxVolumeToDeliver) + self.routeofAdministration = try CodeableConcept(from: _container, forKeyIfPresent: .routeofAdministration) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try additiveProductName?.encode(on: &_container, forKey: .additiveProductName, auxiliaryKey: ._additiveProductName) + try additiveType?.encode(on: &_container, forKey: .additiveType) + try administration?.encode(on: &_container, forKey: .administration) + try administrationInstruction?.encode(on: &_container, forKey: .administrationInstruction, auxiliaryKey: ._administrationInstruction) + try baseFormulaProductName?.encode(on: &_container, forKey: .baseFormulaProductName, auxiliaryKey: ._baseFormulaProductName) + try baseFormulaType?.encode(on: &_container, forKey: .baseFormulaType) + try caloricDensity?.encode(on: &_container, forKey: .caloricDensity) + try maxVolumeToDeliver?.encode(on: &_container, forKey: .maxVolumeToDeliver) + try routeofAdministration?.encode(on: &_container, forKey: .routeofAdministration) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? NutritionOrderEnteralFormula else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return additiveProductName == _other.additiveProductName + && additiveType == _other.additiveType + && administration == _other.administration + && administrationInstruction == _other.administrationInstruction + && baseFormulaProductName == _other.baseFormulaProductName + && baseFormulaType == _other.baseFormulaType + && caloricDensity == _other.caloricDensity + && maxVolumeToDeliver == _other.maxVolumeToDeliver + && routeofAdministration == _other.routeofAdministration + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(additiveProductName) + hasher.combine(additiveType) + hasher.combine(administration) + hasher.combine(administrationInstruction) + hasher.combine(baseFormulaProductName) + hasher.combine(baseFormulaType) + hasher.combine(caloricDensity) + hasher.combine(maxVolumeToDeliver) + hasher.combine(routeofAdministration) + } +} + +/** + Formula feeding instruction as structured data. + + Formula administration instructions as structured data. This repeating structure allows for changing the + administration rate or volume over time for both bolus and continuous feeding. An example of this would be an + instruction to increase the rate of continuous feeding every 2 hours. + */ +open class NutritionOrderEnteralFormulaAdministration: BackboneElement { + + /// All possible types for "rate[x]" + public enum RateX: Hashable { + case quantity(Quantity) + case ratio(Ratio) + } + + /// Scheduled frequency of enteral feeding + public var schedule: Timing? + + /// The volume of formula to provide + public var quantity: Quantity? + + /// Speed with which the formula is provided per period of time + /// One of `rate[x]` + public var rate: RateX? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + quantity: Quantity? = nil, + rate: RateX? = nil, + schedule: Timing? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.quantity = quantity + self.rate = rate + self.schedule = schedule + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case quantity + case rateQuantity + case rateRatio + case schedule + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + var _t_rate: RateX? = nil + if let rateQuantity = try Quantity(from: _container, forKeyIfPresent: .rateQuantity) { + if _t_rate != nil { + throw DecodingError.dataCorruptedError(forKey: .rateQuantity, in: _container, debugDescription: "More than one value provided for \"rate\"") + } + _t_rate = .quantity(rateQuantity) + } + if let rateRatio = try Ratio(from: _container, forKeyIfPresent: .rateRatio) { + if _t_rate != nil { + throw DecodingError.dataCorruptedError(forKey: .rateRatio, in: _container, debugDescription: "More than one value provided for \"rate\"") + } + _t_rate = .ratio(rateRatio) + } + self.rate = _t_rate + self.schedule = try Timing(from: _container, forKeyIfPresent: .schedule) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try quantity?.encode(on: &_container, forKey: .quantity) + if let _enum = rate { + switch _enum { + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .rateQuantity) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .rateRatio) + } + } + try schedule?.encode(on: &_container, forKey: .schedule) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? NutritionOrderEnteralFormulaAdministration else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return quantity == _other.quantity + && rate == _other.rate + && schedule == _other.schedule + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(quantity) + hasher.combine(rate) + hasher.combine(schedule) + } +} + +/** + Oral diet components. + + Diet given orally in contrast to enteral (tube) feeding. + */ +open class NutritionOrderOralDiet: BackboneElement { + + /// Type of oral diet or diet restrictions that describe what can be consumed orally + public var type: [CodeableConcept]? + + /// Scheduled frequency of diet + public var schedule: [Timing]? + + /// Required nutrient modifications + public var nutrient: [NutritionOrderOralDietNutrient]? + + /// Required texture modifications + public var texture: [NutritionOrderOralDietTexture]? + + /// The required consistency of fluids and liquids provided to the patient + public var fluidConsistencyType: [CodeableConcept]? + + /// Instructions or additional information about the oral diet + public var instruction: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + fluidConsistencyType: [CodeableConcept]? = nil, + id: FHIRPrimitive? = nil, + instruction: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + nutrient: [NutritionOrderOralDietNutrient]? = nil, + schedule: [Timing]? = nil, + texture: [NutritionOrderOralDietTexture]? = nil, + type: [CodeableConcept]? = nil) + { + self.init() + self.`extension` = `extension` + self.fluidConsistencyType = fluidConsistencyType + self.id = id + self.instruction = instruction + self.modifierExtension = modifierExtension + self.nutrient = nutrient + self.schedule = schedule + self.texture = texture + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case fluidConsistencyType + case instruction; case _instruction + case nutrient + case schedule + case texture + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.fluidConsistencyType = try [CodeableConcept](from: _container, forKeyIfPresent: .fluidConsistencyType) + self.instruction = try FHIRPrimitive(from: _container, forKeyIfPresent: .instruction, auxiliaryKey: ._instruction) + self.nutrient = try [NutritionOrderOralDietNutrient](from: _container, forKeyIfPresent: .nutrient) + self.schedule = try [Timing](from: _container, forKeyIfPresent: .schedule) + self.texture = try [NutritionOrderOralDietTexture](from: _container, forKeyIfPresent: .texture) + self.type = try [CodeableConcept](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try fluidConsistencyType?.encode(on: &_container, forKey: .fluidConsistencyType) + try instruction?.encode(on: &_container, forKey: .instruction, auxiliaryKey: ._instruction) + try nutrient?.encode(on: &_container, forKey: .nutrient) + try schedule?.encode(on: &_container, forKey: .schedule) + try texture?.encode(on: &_container, forKey: .texture) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? NutritionOrderOralDiet else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return fluidConsistencyType == _other.fluidConsistencyType + && instruction == _other.instruction + && nutrient == _other.nutrient + && schedule == _other.schedule + && texture == _other.texture + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(fluidConsistencyType) + hasher.combine(instruction) + hasher.combine(nutrient) + hasher.combine(schedule) + hasher.combine(texture) + hasher.combine(type) + } +} + +/** + Required nutrient modifications. + + Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required + for the oral diet. + */ +open class NutritionOrderOralDietNutrient: BackboneElement { + + /// Type of nutrient that is being modified + public var modifier: CodeableConcept? + + /// Quantity of the specified nutrient + public var amount: Quantity? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + amount: Quantity? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifier: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.amount = amount + self.`extension` = `extension` + self.id = id + self.modifier = modifier + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case amount + case modifier + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.amount = try Quantity(from: _container, forKeyIfPresent: .amount) + self.modifier = try CodeableConcept(from: _container, forKeyIfPresent: .modifier) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try amount?.encode(on: &_container, forKey: .amount) + try modifier?.encode(on: &_container, forKey: .modifier) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? NutritionOrderOralDietNutrient else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return amount == _other.amount + && modifier == _other.modifier + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(amount) + hasher.combine(modifier) + } +} + +/** + Required texture modifications. + + Class that describes any texture modifications required for the patient to safely consume various types of solid foods. + */ +open class NutritionOrderOralDietTexture: BackboneElement { + + /// Code to indicate how to alter the texture of the foods, e.g. pureed + public var modifier: CodeableConcept? + + /// Concepts that are used to identify an entity that is ingested for nutritional purposes + public var foodType: CodeableConcept? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + foodType: CodeableConcept? = nil, + id: FHIRPrimitive? = nil, + modifier: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.`extension` = `extension` + self.foodType = foodType + self.id = id + self.modifier = modifier + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case foodType + case modifier + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.foodType = try CodeableConcept(from: _container, forKeyIfPresent: .foodType) + self.modifier = try CodeableConcept(from: _container, forKeyIfPresent: .modifier) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try foodType?.encode(on: &_container, forKey: .foodType) + try modifier?.encode(on: &_container, forKey: .modifier) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? NutritionOrderOralDietTexture else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return foodType == _other.foodType + && modifier == _other.modifier + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(foodType) + hasher.combine(modifier) + } +} + +/** + Supplement components. + + Oral nutritional products given in order to add further nutritional value to the patient's diet. + */ +open class NutritionOrderSupplement: BackboneElement { + + /// Type of supplement product requested + public var type: CodeableConcept? + + /// Product or brand name of the nutritional supplement + public var productName: FHIRPrimitive? + + /// Scheduled frequency of supplement + public var schedule: [Timing]? + + /// Amount of the nutritional supplement + public var quantity: Quantity? + + /// Instructions or additional information about the oral supplement + public var instruction: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + instruction: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + productName: FHIRPrimitive? = nil, + quantity: Quantity? = nil, + schedule: [Timing]? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.instruction = instruction + self.modifierExtension = modifierExtension + self.productName = productName + self.quantity = quantity + self.schedule = schedule + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case instruction; case _instruction + case productName; case _productName + case quantity + case schedule + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.instruction = try FHIRPrimitive(from: _container, forKeyIfPresent: .instruction, auxiliaryKey: ._instruction) + self.productName = try FHIRPrimitive(from: _container, forKeyIfPresent: .productName, auxiliaryKey: ._productName) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.schedule = try [Timing](from: _container, forKeyIfPresent: .schedule) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try instruction?.encode(on: &_container, forKey: .instruction, auxiliaryKey: ._instruction) + try productName?.encode(on: &_container, forKey: .productName, auxiliaryKey: ._productName) + try quantity?.encode(on: &_container, forKey: .quantity) + try schedule?.encode(on: &_container, forKey: .schedule) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? NutritionOrderSupplement else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return instruction == _other.instruction + && productName == _other.productName + && quantity == _other.quantity + && schedule == _other.schedule + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(instruction) + hasher.combine(productName) + hasher.combine(quantity) + hasher.combine(schedule) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/Observation.swift b/Sources/ModelsSTU3/Observation.swift new file mode 100644 index 0000000..06aba44 --- /dev/null +++ b/Sources/ModelsSTU3/Observation.swift @@ -0,0 +1,873 @@ +// +// Observation.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Observation) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Measurements and simple assertions. + + Measurements and simple assertions made about a patient, device or other subject. + */ +open class Observation: DomainResource { + + override open class var resourceType: ResourceType { return .observation } + + /// All possible types for "effective[x]" + public enum EffectiveX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case attachment(Attachment) + case boolean(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case dateTime(FHIRPrimitive) + case period(Period) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case sampledData(SampledData) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + } + + /// Business Identifier for observation + public var identifier: [Identifier]? + + /// Fulfills plan, proposal or order + public var basedOn: [Reference]? + + /// The status of the result value. + public var status: FHIRPrimitive + + /// Classification of type of observation + public var category: [CodeableConcept]? + + /// Type of observation (code / type) + public var code: CodeableConcept + + /// Who and/or what this is about + public var subject: Reference? + + /// Healthcare event during which this observation is made + public var context: Reference? + + /// Clinically relevant time/time-period for observation + /// One of `effective[x]` + public var effective: EffectiveX? + + /// Date/Time this was made available + public var issued: FHIRPrimitive? + + /// Who is responsible for the observation + public var performer: [Reference]? + + /// Actual result + /// One of `value[x]` + public var value: ValueX? + + /// Why the result is missing + public var dataAbsentReason: CodeableConcept? + + /// High, low, normal, etc. + public var interpretation: CodeableConcept? + + /// Comments about result + public var comment: FHIRPrimitive? + + /// Observed body part + public var bodySite: CodeableConcept? + + /// How it was done + public var method: CodeableConcept? + + /// Specimen used for this observation + public var specimen: Reference? + + /// (Measurement) Device + public var device: Reference? + + /// Provides guide for interpretation + public var referenceRange: [ObservationReferenceRange]? + + /// Resource related to this observation + public var related: [ObservationRelated]? + + /// Component results + public var component: [ObservationComponent]? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept, status: FHIRPrimitive) { + self.code = code + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + basedOn: [Reference]? = nil, + bodySite: CodeableConcept? = nil, + category: [CodeableConcept]? = nil, + code: CodeableConcept, + comment: FHIRPrimitive? = nil, + component: [ObservationComponent]? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + dataAbsentReason: CodeableConcept? = nil, + device: Reference? = nil, + effective: EffectiveX? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + interpretation: CodeableConcept? = nil, + issued: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + method: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil, + performer: [Reference]? = nil, + referenceRange: [ObservationReferenceRange]? = nil, + related: [ObservationRelated]? = nil, + specimen: Reference? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil, + value: ValueX? = nil) + { + self.init(code: code, status: status) + self.basedOn = basedOn + self.bodySite = bodySite + self.category = category + self.comment = comment + self.component = component + self.contained = contained + self.context = context + self.dataAbsentReason = dataAbsentReason + self.device = device + self.effective = effective + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.interpretation = interpretation + self.issued = issued + self.language = language + self.meta = meta + self.method = method + self.modifierExtension = modifierExtension + self.performer = performer + self.referenceRange = referenceRange + self.related = related + self.specimen = specimen + self.subject = subject + self.text = text + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case basedOn + case bodySite + case category + case code + case comment; case _comment + case component + case context + case dataAbsentReason + case device + case effectiveDateTime; case _effectiveDateTime + case effectivePeriod + case identifier + case interpretation + case issued; case _issued + case method + case performer + case referenceRange + case related + case specimen + case status; case _status + case subject + case valueAttachment + case valueBoolean; case _valueBoolean + case valueCodeableConcept + case valueDateTime; case _valueDateTime + case valuePeriod + case valueQuantity + case valueRange + case valueRatio + case valueSampledData + case valueString; case _valueString + case valueTime; case _valueTime + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.bodySite = try CodeableConcept(from: _container, forKeyIfPresent: .bodySite) + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.code = try CodeableConcept(from: _container, forKey: .code) + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.component = try [ObservationComponent](from: _container, forKeyIfPresent: .component) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.dataAbsentReason = try CodeableConcept(from: _container, forKeyIfPresent: .dataAbsentReason) + self.device = try Reference(from: _container, forKeyIfPresent: .device) + var _t_effective: EffectiveX? = nil + if let effectiveDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .effectiveDateTime, auxiliaryKey: ._effectiveDateTime) { + if _t_effective != nil { + throw DecodingError.dataCorruptedError(forKey: .effectiveDateTime, in: _container, debugDescription: "More than one value provided for \"effective\"") + } + _t_effective = .dateTime(effectiveDateTime) + } + if let effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) { + if _t_effective != nil { + throw DecodingError.dataCorruptedError(forKey: .effectivePeriod, in: _container, debugDescription: "More than one value provided for \"effective\"") + } + _t_effective = .period(effectivePeriod) + } + self.effective = _t_effective + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.interpretation = try CodeableConcept(from: _container, forKeyIfPresent: .interpretation) + self.issued = try FHIRPrimitive(from: _container, forKeyIfPresent: .issued, auxiliaryKey: ._issued) + self.method = try CodeableConcept(from: _container, forKeyIfPresent: .method) + self.performer = try [Reference](from: _container, forKeyIfPresent: .performer) + self.referenceRange = try [ObservationReferenceRange](from: _container, forKeyIfPresent: .referenceRange) + self.related = try [ObservationRelated](from: _container, forKeyIfPresent: .related) + self.specimen = try Reference(from: _container, forKeyIfPresent: .specimen) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + var _t_value: ValueX? = nil + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .valueCodeableConcept) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .codeableConcept(valueCodeableConcept) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueRange = try Range(from: _container, forKeyIfPresent: .valueRange) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRange, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .range(valueRange) + } + if let valueRatio = try Ratio(from: _container, forKeyIfPresent: .valueRatio) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRatio, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .ratio(valueRatio) + } + if let valueSampledData = try SampledData(from: _container, forKeyIfPresent: .valueSampledData) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSampledData, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .sampledData(valueSampledData) + } + if let valueAttachment = try Attachment(from: _container, forKeyIfPresent: .valueAttachment) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAttachment, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .attachment(valueAttachment) + } + if let valueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueTime, auxiliaryKey: ._valueTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .time(valueTime) + } + if let valueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDateTime, auxiliaryKey: ._valueDateTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDateTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .dateTime(valueDateTime) + } + if let valuePeriod = try Period(from: _container, forKeyIfPresent: .valuePeriod) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePeriod, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .period(valuePeriod) + } + self.value = _t_value + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try basedOn?.encode(on: &_container, forKey: .basedOn) + try bodySite?.encode(on: &_container, forKey: .bodySite) + try category?.encode(on: &_container, forKey: .category) + try code.encode(on: &_container, forKey: .code) + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try component?.encode(on: &_container, forKey: .component) + try context?.encode(on: &_container, forKey: .context) + try dataAbsentReason?.encode(on: &_container, forKey: .dataAbsentReason) + try device?.encode(on: &_container, forKey: .device) + if let _enum = effective { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .effectiveDateTime, auxiliaryKey: ._effectiveDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .effectivePeriod) + } + } + try identifier?.encode(on: &_container, forKey: .identifier) + try interpretation?.encode(on: &_container, forKey: .interpretation) + try issued?.encode(on: &_container, forKey: .issued, auxiliaryKey: ._issued) + try method?.encode(on: &_container, forKey: .method) + try performer?.encode(on: &_container, forKey: .performer) + try referenceRange?.encode(on: &_container, forKey: .referenceRange) + try related?.encode(on: &_container, forKey: .related) + try specimen?.encode(on: &_container, forKey: .specimen) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + if let _enum = value { + switch _enum { + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .valueCodeableConcept) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .range(let _value): + try _value.encode(on: &_container, forKey: .valueRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .valueRatio) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .valueSampledData) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .valueAttachment) + case .time(let _value): + try _value.encode(on: &_container, forKey: .valueTime, auxiliaryKey: ._valueTime) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .valueDateTime, auxiliaryKey: ._valueDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .valuePeriod) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Observation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return basedOn == _other.basedOn + && bodySite == _other.bodySite + && category == _other.category + && code == _other.code + && comment == _other.comment + && component == _other.component + && context == _other.context + && dataAbsentReason == _other.dataAbsentReason + && device == _other.device + && effective == _other.effective + && identifier == _other.identifier + && interpretation == _other.interpretation + && issued == _other.issued + && method == _other.method + && performer == _other.performer + && referenceRange == _other.referenceRange + && related == _other.related + && specimen == _other.specimen + && status == _other.status + && subject == _other.subject + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(basedOn) + hasher.combine(bodySite) + hasher.combine(category) + hasher.combine(code) + hasher.combine(comment) + hasher.combine(component) + hasher.combine(context) + hasher.combine(dataAbsentReason) + hasher.combine(device) + hasher.combine(effective) + hasher.combine(identifier) + hasher.combine(interpretation) + hasher.combine(issued) + hasher.combine(method) + hasher.combine(performer) + hasher.combine(referenceRange) + hasher.combine(related) + hasher.combine(specimen) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(value) + } +} + +/** + Component results. + + Some observations have multiple component observations. These component observations are expressed as separate code + value pairs that share the same attributes. Examples include systolic and diastolic component observations for blood + pressure measurement and multiple component observations for genetics observations. + */ +open class ObservationComponent: BackboneElement { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case attachment(Attachment) + case codeableConcept(CodeableConcept) + case dateTime(FHIRPrimitive) + case period(Period) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case sampledData(SampledData) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + } + + /// Type of component observation (code / type) + public var code: CodeableConcept + + /// Actual component result + /// One of `value[x]` + public var value: ValueX? + + /// Why the component result is missing + public var dataAbsentReason: CodeableConcept? + + /// High, low, normal, etc. + public var interpretation: CodeableConcept? + + /// Provides guide for interpretation of component result + public var referenceRange: [ObservationReferenceRange]? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept, + dataAbsentReason: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + interpretation: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil, + referenceRange: [ObservationReferenceRange]? = nil, + value: ValueX? = nil) + { + self.init(code: code) + self.dataAbsentReason = dataAbsentReason + self.`extension` = `extension` + self.id = id + self.interpretation = interpretation + self.modifierExtension = modifierExtension + self.referenceRange = referenceRange + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case dataAbsentReason + case interpretation + case referenceRange + case valueAttachment + case valueCodeableConcept + case valueDateTime; case _valueDateTime + case valuePeriod + case valueQuantity + case valueRange + case valueRatio + case valueSampledData + case valueString; case _valueString + case valueTime; case _valueTime + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKey: .code) + self.dataAbsentReason = try CodeableConcept(from: _container, forKeyIfPresent: .dataAbsentReason) + self.interpretation = try CodeableConcept(from: _container, forKeyIfPresent: .interpretation) + self.referenceRange = try [ObservationReferenceRange](from: _container, forKeyIfPresent: .referenceRange) + var _t_value: ValueX? = nil + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .valueCodeableConcept) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .codeableConcept(valueCodeableConcept) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueRange = try Range(from: _container, forKeyIfPresent: .valueRange) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRange, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .range(valueRange) + } + if let valueRatio = try Ratio(from: _container, forKeyIfPresent: .valueRatio) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRatio, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .ratio(valueRatio) + } + if let valueSampledData = try SampledData(from: _container, forKeyIfPresent: .valueSampledData) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSampledData, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .sampledData(valueSampledData) + } + if let valueAttachment = try Attachment(from: _container, forKeyIfPresent: .valueAttachment) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAttachment, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .attachment(valueAttachment) + } + if let valueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueTime, auxiliaryKey: ._valueTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .time(valueTime) + } + if let valueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDateTime, auxiliaryKey: ._valueDateTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDateTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .dateTime(valueDateTime) + } + if let valuePeriod = try Period(from: _container, forKeyIfPresent: .valuePeriod) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePeriod, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .period(valuePeriod) + } + self.value = _t_value + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code) + try dataAbsentReason?.encode(on: &_container, forKey: .dataAbsentReason) + try interpretation?.encode(on: &_container, forKey: .interpretation) + try referenceRange?.encode(on: &_container, forKey: .referenceRange) + if let _enum = value { + switch _enum { + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .valueCodeableConcept) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .range(let _value): + try _value.encode(on: &_container, forKey: .valueRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .valueRatio) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .valueSampledData) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .valueAttachment) + case .time(let _value): + try _value.encode(on: &_container, forKey: .valueTime, auxiliaryKey: ._valueTime) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .valueDateTime, auxiliaryKey: ._valueDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .valuePeriod) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ObservationComponent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && dataAbsentReason == _other.dataAbsentReason + && interpretation == _other.interpretation + && referenceRange == _other.referenceRange + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(dataAbsentReason) + hasher.combine(interpretation) + hasher.combine(referenceRange) + hasher.combine(value) + } +} + +/** + Provides guide for interpretation. + + Guidance on how to interpret the value by comparison to a normal or recommended range. + */ +open class ObservationReferenceRange: BackboneElement { + + /// Low Range, if relevant + public var low: Quantity? + + /// High Range, if relevant + public var high: Quantity? + + /// Reference range qualifier + public var type: CodeableConcept? + + /// Reference range population + public var appliesTo: [CodeableConcept]? + + /// Applicable age range, if relevant + public var age: Range? + + /// Text based reference range in an observation + public var text: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + age: Range? = nil, + appliesTo: [CodeableConcept]? = nil, + `extension`: [Extension]? = nil, + high: Quantity? = nil, + id: FHIRPrimitive? = nil, + low: Quantity? = nil, + modifierExtension: [Extension]? = nil, + text: FHIRPrimitive? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.age = age + self.appliesTo = appliesTo + self.`extension` = `extension` + self.high = high + self.id = id + self.low = low + self.modifierExtension = modifierExtension + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case age + case appliesTo + case high + case low + case text; case _text + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.age = try Range(from: _container, forKeyIfPresent: .age) + self.appliesTo = try [CodeableConcept](from: _container, forKeyIfPresent: .appliesTo) + self.high = try Quantity(from: _container, forKeyIfPresent: .high) + self.low = try Quantity(from: _container, forKeyIfPresent: .low) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try age?.encode(on: &_container, forKey: .age) + try appliesTo?.encode(on: &_container, forKey: .appliesTo) + try high?.encode(on: &_container, forKey: .high) + try low?.encode(on: &_container, forKey: .low) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ObservationReferenceRange else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return age == _other.age + && appliesTo == _other.appliesTo + && high == _other.high + && low == _other.low + && text == _other.text + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(age) + hasher.combine(appliesTo) + hasher.combine(high) + hasher.combine(low) + hasher.combine(text) + hasher.combine(type) + } +} + +/** + Resource related to this observation. + + A reference to another resource (usually another Observation) whose relationship is defined by the relationship type + code. + */ +open class ObservationRelated: BackboneElement { + + /// A code specifying the kind of relationship that exists with the target resource. + public var type: FHIRPrimitive? + + /// Resource that is related to this one + public var target: Reference + + /// Designated initializer taking all required properties + public init(target: Reference) { + self.target = target + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + target: Reference, + type: FHIRPrimitive? = nil) + { + self.init(target: target) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case target + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.target = try Reference(from: _container, forKey: .target) + self.type = try FHIRPrimitive(from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try target.encode(on: &_container, forKey: .target) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ObservationRelated else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return target == _other.target + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(target) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/OperationDefinition.swift b/Sources/ModelsSTU3/OperationDefinition.swift new file mode 100644 index 0000000..c722f06 --- /dev/null +++ b/Sources/ModelsSTU3/OperationDefinition.swift @@ -0,0 +1,682 @@ +// +// OperationDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/OperationDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Definition of an operation or a named query. + + A formal computable definition of an operation (on the RESTful interface) or a named query (using the search + interaction). + */ +open class OperationDefinition: DomainResource { + + override open class var resourceType: ResourceType { return .operationDefinition } + + /// Logical URI to reference this operation definition (globally unique) + public var url: FHIRPrimitive? + + /// Business version of the operation definition + public var version: FHIRPrimitive? + + /// Name for this operation definition (computer friendly) + public var name: FHIRPrimitive + + /// The status of this operation definition. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// Whether this is an operation or a named query. + public var kind: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the operation definition + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for operation definition (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Why this operation definition is defined + public var purpose: FHIRPrimitive? + + /// Whether content is unchanged by the operation + public var idempotent: FHIRPrimitive? + + /// Name used to invoke the operation + public var code: FHIRPrimitive + + /// Additional information about use + public var comment: FHIRPrimitive? + + /// Marks this as a profile of the base + public var base: Reference? + + /// The types on which this operation can be executed. + public var resource: [FHIRPrimitive]? + + /// Invoke at the system level? + public var system: FHIRPrimitive + + /// Invole at the type level? + public var type: FHIRPrimitive + + /// Invoke on an instance? + public var instance: FHIRPrimitive + + /// Parameters for the operation/query + public var parameter: [OperationDefinitionParameter]? + + /// Define overloaded variants for when generating code + public var overload: [OperationDefinitionOverload]? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, instance: FHIRPrimitive, kind: FHIRPrimitive, name: FHIRPrimitive, status: FHIRPrimitive, system: FHIRPrimitive, type: FHIRPrimitive) { + self.code = code + self.instance = instance + self.kind = kind + self.name = name + self.status = status + self.system = system + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + base: Reference? = nil, + code: FHIRPrimitive, + comment: FHIRPrimitive? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + idempotent: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + instance: FHIRPrimitive, + jurisdiction: [CodeableConcept]? = nil, + kind: FHIRPrimitive, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + overload: [OperationDefinitionOverload]? = nil, + parameter: [OperationDefinitionParameter]? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + resource: [FHIRPrimitive]? = nil, + status: FHIRPrimitive, + system: FHIRPrimitive, + text: Narrative? = nil, + type: FHIRPrimitive, + url: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(code: code, instance: instance, kind: kind, name: name, status: status, system: system, type: type) + self.base = base + self.comment = comment + self.contact = contact + self.contained = contained + self.date = date + self.description_fhir = description_fhir + self.experimental = experimental + self.`extension` = `extension` + self.id = id + self.idempotent = idempotent + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.overload = overload + self.parameter = parameter + self.publisher = publisher + self.purpose = purpose + self.resource = resource + self.text = text + self.url = url + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case base + case code; case _code + case comment; case _comment + case contact + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case experimental; case _experimental + case idempotent; case _idempotent + case instance; case _instance + case jurisdiction + case kind; case _kind + case name; case _name + case overload + case parameter + case publisher; case _publisher + case purpose; case _purpose + case resource; case _resource + case status; case _status + case system; case _system + case type; case _type + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.base = try Reference(from: _container, forKeyIfPresent: .base) + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.idempotent = try FHIRPrimitive(from: _container, forKeyIfPresent: .idempotent, auxiliaryKey: ._idempotent) + self.instance = try FHIRPrimitive(from: _container, forKey: .instance, auxiliaryKey: ._instance) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.kind = try FHIRPrimitive(from: _container, forKey: .kind, auxiliaryKey: ._kind) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.overload = try [OperationDefinitionOverload](from: _container, forKeyIfPresent: .overload) + self.parameter = try [OperationDefinitionParameter](from: _container, forKeyIfPresent: .parameter) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.resource = try [FHIRPrimitive](from: _container, forKeyIfPresent: .resource, auxiliaryKey: ._resource) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.system = try FHIRPrimitive(from: _container, forKey: .system, auxiliaryKey: ._system) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try base?.encode(on: &_container, forKey: .base) + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try contact?.encode(on: &_container, forKey: .contact) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try idempotent?.encode(on: &_container, forKey: .idempotent, auxiliaryKey: ._idempotent) + try instance.encode(on: &_container, forKey: .instance, auxiliaryKey: ._instance) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try kind.encode(on: &_container, forKey: .kind, auxiliaryKey: ._kind) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try overload?.encode(on: &_container, forKey: .overload) + try parameter?.encode(on: &_container, forKey: .parameter) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try resource?.encode(on: &_container, forKey: .resource, auxiliaryKey: ._resource) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try system.encode(on: &_container, forKey: .system, auxiliaryKey: ._system) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? OperationDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return base == _other.base + && code == _other.code + && comment == _other.comment + && contact == _other.contact + && date == _other.date + && description_fhir == _other.description_fhir + && experimental == _other.experimental + && idempotent == _other.idempotent + && instance == _other.instance + && jurisdiction == _other.jurisdiction + && kind == _other.kind + && name == _other.name + && overload == _other.overload + && parameter == _other.parameter + && publisher == _other.publisher + && purpose == _other.purpose + && resource == _other.resource + && status == _other.status + && system == _other.system + && type == _other.type + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(base) + hasher.combine(code) + hasher.combine(comment) + hasher.combine(contact) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(experimental) + hasher.combine(idempotent) + hasher.combine(instance) + hasher.combine(jurisdiction) + hasher.combine(kind) + hasher.combine(name) + hasher.combine(overload) + hasher.combine(parameter) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(resource) + hasher.combine(status) + hasher.combine(system) + hasher.combine(type) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Define overloaded variants for when generating code. + + Defines an appropriate combination of parameters to use when invoking this operation, to help code generators when + generating overloaded parameter sets for this operation. + */ +open class OperationDefinitionOverload: BackboneElement { + + /// Name of parameter to include in overload + public var parameterName: [FHIRPrimitive]? + + /// Comments to go on overload + public var comment: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + comment: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + parameterName: [FHIRPrimitive]? = nil) + { + self.init() + self.comment = comment + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.parameterName = parameterName + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case comment; case _comment + case parameterName; case _parameterName + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.parameterName = try [FHIRPrimitive](from: _container, forKeyIfPresent: .parameterName, auxiliaryKey: ._parameterName) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try parameterName?.encode(on: &_container, forKey: .parameterName, auxiliaryKey: ._parameterName) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? OperationDefinitionOverload else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return comment == _other.comment + && parameterName == _other.parameterName + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(comment) + hasher.combine(parameterName) + } +} + +/** + Parameters for the operation/query. + + The parameters for the operation/query. + */ +open class OperationDefinitionParameter: BackboneElement { + + /// Name in Parameters.parameter.name or in URL + public var name: FHIRPrimitive + + /// Whether this is an input or an output parameter. + public var use: FHIRPrimitive + + /// Minimum Cardinality + public var min: FHIRPrimitive + + /// Maximum Cardinality (a number or *) + public var max: FHIRPrimitive + + /// Description of meaning/use + public var documentation: FHIRPrimitive? + + /// What type this parameter has + public var type: FHIRPrimitive? + + /// How the parameter is understood as a search parameter. This is only used if the parameter type is 'string'. + public var searchType: FHIRPrimitive? + + /// Profile on the type + public var profile: Reference? + + /// ValueSet details if this is coded + public var binding: OperationDefinitionParameterBinding? + + /// Parts of a nested Parameter + public var part: [OperationDefinitionParameter]? + + /// Designated initializer taking all required properties + public init(max: FHIRPrimitive, min: FHIRPrimitive, name: FHIRPrimitive, use: FHIRPrimitive) { + self.max = max + self.min = min + self.name = name + self.use = use + super.init() + } + + /// Convenience initializer + public convenience init( + binding: OperationDefinitionParameterBinding? = nil, + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + max: FHIRPrimitive, + min: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + part: [OperationDefinitionParameter]? = nil, + profile: Reference? = nil, + searchType: FHIRPrimitive? = nil, + type: FHIRPrimitive? = nil, + use: FHIRPrimitive) + { + self.init(max: max, min: min, name: name, use: use) + self.binding = binding + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.part = part + self.profile = profile + self.searchType = searchType + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case binding + case documentation; case _documentation + case max; case _max + case min; case _min + case name; case _name + case part + case profile + case searchType; case _searchType + case type; case _type + case use; case _use + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.binding = try OperationDefinitionParameterBinding(from: _container, forKeyIfPresent: .binding) + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.max = try FHIRPrimitive(from: _container, forKey: .max, auxiliaryKey: ._max) + self.min = try FHIRPrimitive(from: _container, forKey: .min, auxiliaryKey: ._min) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.part = try [OperationDefinitionParameter](from: _container, forKeyIfPresent: .part) + self.profile = try Reference(from: _container, forKeyIfPresent: .profile) + self.searchType = try FHIRPrimitive(from: _container, forKeyIfPresent: .searchType, auxiliaryKey: ._searchType) + self.type = try FHIRPrimitive(from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + self.use = try FHIRPrimitive(from: _container, forKey: .use, auxiliaryKey: ._use) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try binding?.encode(on: &_container, forKey: .binding) + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try max.encode(on: &_container, forKey: .max, auxiliaryKey: ._max) + try min.encode(on: &_container, forKey: .min, auxiliaryKey: ._min) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try part?.encode(on: &_container, forKey: .part) + try profile?.encode(on: &_container, forKey: .profile) + try searchType?.encode(on: &_container, forKey: .searchType, auxiliaryKey: ._searchType) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try use.encode(on: &_container, forKey: .use, auxiliaryKey: ._use) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? OperationDefinitionParameter else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return binding == _other.binding + && documentation == _other.documentation + && max == _other.max + && min == _other.min + && name == _other.name + && part == _other.part + && profile == _other.profile + && searchType == _other.searchType + && type == _other.type + && use == _other.use + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(binding) + hasher.combine(documentation) + hasher.combine(max) + hasher.combine(min) + hasher.combine(name) + hasher.combine(part) + hasher.combine(profile) + hasher.combine(searchType) + hasher.combine(type) + hasher.combine(use) + } +} + +/** + ValueSet details if this is coded. + + Binds to a value set if this parameter is coded (code, Coding, CodeableConcept). + */ +open class OperationDefinitionParameterBinding: BackboneElement { + + /// All possible types for "valueSet[x]" + public enum ValueSetX: Hashable { + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the + /// provided value set must be adhered to in the instances. + public var strength: FHIRPrimitive + + /// Source of value set + /// One of `valueSet[x]` + public var valueSet: ValueSetX + + /// Designated initializer taking all required properties + public init(strength: FHIRPrimitive, valueSet: ValueSetX) { + self.strength = strength + self.valueSet = valueSet + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + strength: FHIRPrimitive, + valueSet: ValueSetX) + { + self.init(strength: strength, valueSet: valueSet) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case strength; case _strength + case valueSetReference + case valueSetUri; case _valueSetUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.valueSetReference) || _container.contains(CodingKeys.valueSetUri) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.valueSetReference, CodingKeys.valueSetUri], debugDescription: "Must have at least one value for \"valueSet\" but have none")) + } + + // Decode all our properties + self.strength = try FHIRPrimitive(from: _container, forKey: .strength, auxiliaryKey: ._strength) + var _t_valueSet: ValueSetX? = nil + if let valueSetUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueSetUri, auxiliaryKey: ._valueSetUri) { + if _t_valueSet != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSetUri, in: _container, debugDescription: "More than one value provided for \"valueSet\"") + } + _t_valueSet = .uri(valueSetUri) + } + if let valueSetReference = try Reference(from: _container, forKeyIfPresent: .valueSetReference) { + if _t_valueSet != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSetReference, in: _container, debugDescription: "More than one value provided for \"valueSet\"") + } + _t_valueSet = .reference(valueSetReference) + } + self.valueSet = _t_valueSet! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try strength.encode(on: &_container, forKey: .strength, auxiliaryKey: ._strength) + + switch valueSet { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .valueSetUri, auxiliaryKey: ._valueSetUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueSetReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? OperationDefinitionParameterBinding else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return strength == _other.strength + && valueSet == _other.valueSet + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(strength) + hasher.combine(valueSet) + } +} diff --git a/Sources/ModelsSTU3/OperationOutcome.swift b/Sources/ModelsSTU3/OperationOutcome.swift new file mode 100644 index 0000000..55ed820 --- /dev/null +++ b/Sources/ModelsSTU3/OperationOutcome.swift @@ -0,0 +1,225 @@ +// +// OperationOutcome.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/OperationOutcome) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Information about the success/failure of an action. + + A collection of error, warning or information messages that result from a system action. + */ +open class OperationOutcome: DomainResource { + + override open class var resourceType: ResourceType { return .operationOutcome } + + /// A single issue associated with the action + public var issue: [OperationOutcomeIssue] + + /// Designated initializer taking all required properties + public init(issue: [OperationOutcomeIssue]) { + self.issue = issue + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + issue: [OperationOutcomeIssue], + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + text: Narrative? = nil) + { + self.init(issue: issue) + self.contained = contained + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case issue + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.issue = try [OperationOutcomeIssue](from: _container, forKey: .issue) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try issue.encode(on: &_container, forKey: .issue) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? OperationOutcome else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return issue == _other.issue + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(issue) + } +} + +/** + A single issue associated with the action. + + An error, warning or information message that results from a system action. + */ +open class OperationOutcomeIssue: BackboneElement { + + /// Indicates whether the issue indicates a variation from successful processing. + public var severity: FHIRPrimitive + + /// Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable + /// code from the IssueType value set, and may additional provide its own code for the error in the details element. + public var code: FHIRPrimitive + + /// Additional details about the error + public var details: CodeableConcept? + + /// Additional diagnostic information about the issue + public var diagnostics: FHIRPrimitive? + + /// Path of element(s) related to issue + public var location: [FHIRPrimitive]? + + /// FHIRPath of element(s) related to issue + public var expression: [FHIRPrimitive]? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive, severity: FHIRPrimitive) { + self.code = code + self.severity = severity + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + details: CodeableConcept? = nil, + diagnostics: FHIRPrimitive? = nil, + expression: [FHIRPrimitive]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + location: [FHIRPrimitive]? = nil, + modifierExtension: [Extension]? = nil, + severity: FHIRPrimitive) + { + self.init(code: code, severity: severity) + self.details = details + self.diagnostics = diagnostics + self.expression = expression + self.`extension` = `extension` + self.id = id + self.location = location + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case details + case diagnostics; case _diagnostics + case expression; case _expression + case location; case _location + case severity; case _severity + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.details = try CodeableConcept(from: _container, forKeyIfPresent: .details) + self.diagnostics = try FHIRPrimitive(from: _container, forKeyIfPresent: .diagnostics, auxiliaryKey: ._diagnostics) + self.expression = try [FHIRPrimitive](from: _container, forKeyIfPresent: .expression, auxiliaryKey: ._expression) + self.location = try [FHIRPrimitive](from: _container, forKeyIfPresent: .location, auxiliaryKey: ._location) + self.severity = try FHIRPrimitive(from: _container, forKey: .severity, auxiliaryKey: ._severity) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try details?.encode(on: &_container, forKey: .details) + try diagnostics?.encode(on: &_container, forKey: .diagnostics, auxiliaryKey: ._diagnostics) + try expression?.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try location?.encode(on: &_container, forKey: .location, auxiliaryKey: ._location) + try severity.encode(on: &_container, forKey: .severity, auxiliaryKey: ._severity) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? OperationOutcomeIssue else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && details == _other.details + && diagnostics == _other.diagnostics + && expression == _other.expression + && location == _other.location + && severity == _other.severity + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(details) + hasher.combine(diagnostics) + hasher.combine(expression) + hasher.combine(location) + hasher.combine(severity) + } +} diff --git a/Sources/ModelsSTU3/Organization.swift b/Sources/ModelsSTU3/Organization.swift new file mode 100644 index 0000000..49ea210 --- /dev/null +++ b/Sources/ModelsSTU3/Organization.swift @@ -0,0 +1,294 @@ +// +// Organization.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Organization) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A grouping of people or organizations with a common purpose. + + A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form + of collective action. Includes companies, institutions, corporations, departments, community groups, healthcare + practice groups, etc. + */ +open class Organization: DomainResource { + + override open class var resourceType: ResourceType { return .organization } + + /// Identifies this organization across multiple systems + public var identifier: [Identifier]? + + /// Whether the organization's record is still in active use + public var active: FHIRPrimitive? + + /// Kind of organization + public var type: [CodeableConcept]? + + /// Name used for the organization + public var name: FHIRPrimitive? + + /// A list of alternate names that the organization is known as, or was known as in the past + public var alias: [FHIRPrimitive]? + + /// A contact detail for the organization + public var telecom: [ContactPoint]? + + /// An address for the organization + public var address: [Address]? + + /// The organization of which this organization forms a part + public var partOf: Reference? + + /// Contact for the organization for a certain purpose + public var contact: [OrganizationContact]? + + /// Technical endpoints providing access to services operated for the organization + public var endpoint: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + address: [Address]? = nil, + alias: [FHIRPrimitive]? = nil, + contact: [OrganizationContact]? = nil, + contained: [ResourceProxy]? = nil, + endpoint: [Reference]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + partOf: Reference? = nil, + telecom: [ContactPoint]? = nil, + text: Narrative? = nil, + type: [CodeableConcept]? = nil) + { + self.init() + self.active = active + self.address = address + self.alias = alias + self.contact = contact + self.contained = contained + self.endpoint = endpoint + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.partOf = partOf + self.telecom = telecom + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case address + case alias; case _alias + case contact + case endpoint + case identifier + case name; case _name + case partOf + case telecom + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.address = try [Address](from: _container, forKeyIfPresent: .address) + self.alias = try [FHIRPrimitive](from: _container, forKeyIfPresent: .alias, auxiliaryKey: ._alias) + self.contact = try [OrganizationContact](from: _container, forKeyIfPresent: .contact) + self.endpoint = try [Reference](from: _container, forKeyIfPresent: .endpoint) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.partOf = try Reference(from: _container, forKeyIfPresent: .partOf) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + self.type = try [CodeableConcept](from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try address?.encode(on: &_container, forKey: .address) + try alias?.encode(on: &_container, forKey: .alias, auxiliaryKey: ._alias) + try contact?.encode(on: &_container, forKey: .contact) + try endpoint?.encode(on: &_container, forKey: .endpoint) + try identifier?.encode(on: &_container, forKey: .identifier) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try partOf?.encode(on: &_container, forKey: .partOf) + try telecom?.encode(on: &_container, forKey: .telecom) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Organization else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && address == _other.address + && alias == _other.alias + && contact == _other.contact + && endpoint == _other.endpoint + && identifier == _other.identifier + && name == _other.name + && partOf == _other.partOf + && telecom == _other.telecom + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(address) + hasher.combine(alias) + hasher.combine(contact) + hasher.combine(endpoint) + hasher.combine(identifier) + hasher.combine(name) + hasher.combine(partOf) + hasher.combine(telecom) + hasher.combine(type) + } +} + +/** + Contact for the organization for a certain purpose. + */ +open class OrganizationContact: BackboneElement { + + /// The type of contact + public var purpose: CodeableConcept? + + /// A name associated with the contact + public var name: HumanName? + + /// Contact details (telephone, email, etc.) for a contact + public var telecom: [ContactPoint]? + + /// Visiting or postal addresses for the contact + public var address: Address? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + address: Address? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: HumanName? = nil, + purpose: CodeableConcept? = nil, + telecom: [ContactPoint]? = nil) + { + self.init() + self.address = address + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.name = name + self.purpose = purpose + self.telecom = telecom + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case address + case name + case purpose + case telecom + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.address = try Address(from: _container, forKeyIfPresent: .address) + self.name = try HumanName(from: _container, forKeyIfPresent: .name) + self.purpose = try CodeableConcept(from: _container, forKeyIfPresent: .purpose) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try address?.encode(on: &_container, forKey: .address) + try name?.encode(on: &_container, forKey: .name) + try purpose?.encode(on: &_container, forKey: .purpose) + try telecom?.encode(on: &_container, forKey: .telecom) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? OrganizationContact else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return address == _other.address + && name == _other.name + && purpose == _other.purpose + && telecom == _other.telecom + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(address) + hasher.combine(name) + hasher.combine(purpose) + hasher.combine(telecom) + } +} diff --git a/Sources/ModelsSTU3/ParameterDefinition.swift b/Sources/ModelsSTU3/ParameterDefinition.swift new file mode 100644 index 0000000..5455162 --- /dev/null +++ b/Sources/ModelsSTU3/ParameterDefinition.swift @@ -0,0 +1,150 @@ +// +// ParameterDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ParameterDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Definition of a parameter to a module. + + The parameters to the module. This collection specifies both the input and output parameters. Input parameters are + provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse. + */ +open class ParameterDefinition: Element { + + /// Name used to access the parameter value + public var name: FHIRPrimitive? + + /// Whether the parameter is input or output for the module. + public var use: FHIRPrimitive + + /// Minimum cardinality + public var min: FHIRPrimitive? + + /// Maximum cardinality (a number of *) + public var max: FHIRPrimitive? + + /// A brief description of the parameter + public var documentation: FHIRPrimitive? + + /// What type of value + public var type: FHIRPrimitive + + /// What profile the value is expected to be + public var profile: Reference? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive, use: FHIRPrimitive) { + self.type = type + self.use = use + super.init() + } + + /// Convenience initializer + public convenience init( + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + max: FHIRPrimitive? = nil, + min: FHIRPrimitive? = nil, + name: FHIRPrimitive? = nil, + profile: Reference? = nil, + type: FHIRPrimitive, + use: FHIRPrimitive) + { + self.init(type: type, use: use) + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.max = max + self.min = min + self.name = name + self.profile = profile + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case documentation; case _documentation + case max; case _max + case min; case _min + case name; case _name + case profile + case type; case _type + case use; case _use + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.max = try FHIRPrimitive(from: _container, forKeyIfPresent: .max, auxiliaryKey: ._max) + self.min = try FHIRPrimitive(from: _container, forKeyIfPresent: .min, auxiliaryKey: ._min) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.profile = try Reference(from: _container, forKeyIfPresent: .profile) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.use = try FHIRPrimitive(from: _container, forKey: .use, auxiliaryKey: ._use) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try max?.encode(on: &_container, forKey: .max, auxiliaryKey: ._max) + try min?.encode(on: &_container, forKey: .min, auxiliaryKey: ._min) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try profile?.encode(on: &_container, forKey: .profile) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try use.encode(on: &_container, forKey: .use, auxiliaryKey: ._use) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ParameterDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return documentation == _other.documentation + && max == _other.max + && min == _other.min + && name == _other.name + && profile == _other.profile + && type == _other.type + && use == _other.use + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(documentation) + hasher.combine(max) + hasher.combine(min) + hasher.combine(name) + hasher.combine(profile) + hasher.combine(type) + hasher.combine(use) + } +} diff --git a/Sources/ModelsSTU3/Parameters.swift b/Sources/ModelsSTU3/Parameters.swift new file mode 100644 index 0000000..141d0a6 --- /dev/null +++ b/Sources/ModelsSTU3/Parameters.swift @@ -0,0 +1,585 @@ +// +// Parameters.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Parameters) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Operation Request or Response. + + This special resource type is used to represent an operation request and response (operations.html). It has no other + use, and there is no RESTful endpoint associated with it. + */ +open class Parameters: Resource { + + override open class var resourceType: ResourceType { return .parameters } + + /// Operation Parameter + public var parameter: [ParametersParameter]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + parameter: [ParametersParameter]? = nil) + { + self.init() + self.id = id + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.parameter = parameter + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case parameter + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.parameter = try [ParametersParameter](from: _container, forKeyIfPresent: .parameter) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try parameter?.encode(on: &_container, forKey: .parameter) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Parameters else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return parameter == _other.parameter + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(parameter) + } +} + +/** + Operation Parameter. + + A parameter passed to or received from the operation. + */ +open class ParametersParameter: BackboneElement { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case address(Address) + case age(Age) + case annotation(Annotation) + case attachment(Attachment) + case base64Binary(FHIRPrimitive) + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case coding(Coding) + case contactPoint(ContactPoint) + case count(Count) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case distance(Distance) + case duration(Duration) + case humanName(HumanName) + case id(FHIRPrimitive) + case identifier(Identifier) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case markdown(FHIRPrimitive) + case meta(Meta) + case money(Money) + case oid(FHIRPrimitive) + case period(Period) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case reference(Reference) + case sampledData(SampledData) + case signature(Signature) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case timing(Timing) + case unsignedInt(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// Name from the definition + public var name: FHIRPrimitive + + /// If parameter is a data type + /// One of `value[x]` + public var value: ValueX? + + /// If parameter is a whole resource + public var resource: ResourceProxy? + + /// Named part of a multi-part parameter + public var part: [ParametersParameter]? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive) { + self.name = name + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + part: [ParametersParameter]? = nil, + resource: ResourceProxy? = nil, + value: ValueX? = nil) + { + self.init(name: name) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.part = part + self.resource = resource + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case name; case _name + case part + case resource + case valueAddress + case valueAge + case valueAnnotation + case valueAttachment + case valueBase64Binary; case _valueBase64Binary + case valueBoolean; case _valueBoolean + case valueCode; case _valueCode + case valueCodeableConcept + case valueCoding + case valueContactPoint + case valueCount + case valueDate; case _valueDate + case valueDateTime; case _valueDateTime + case valueDecimal; case _valueDecimal + case valueDistance + case valueDuration + case valueHumanName + case valueId; case _valueId + case valueIdentifier + case valueInstant; case _valueInstant + case valueInteger; case _valueInteger + case valueMarkdown; case _valueMarkdown + case valueMeta + case valueMoney + case valueOid; case _valueOid + case valuePeriod + case valuePositiveInt; case _valuePositiveInt + case valueQuantity + case valueRange + case valueRatio + case valueReference + case valueSampledData + case valueSignature + case valueString; case _valueString + case valueTime; case _valueTime + case valueTiming + case valueUnsignedInt; case _valueUnsignedInt + case valueUri; case _valueUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.part = try [ParametersParameter](from: _container, forKeyIfPresent: .part) + self.resource = try ResourceProxy(from: _container, forKeyIfPresent: .resource) + var _t_value: ValueX? = nil + if let valueBase64Binary = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBase64Binary, auxiliaryKey: ._valueBase64Binary) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBase64Binary, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .base64Binary(valueBase64Binary) + } + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueCode, auxiliaryKey: ._valueCode) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCode, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .code(valueCode) + } + if let valueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDate, auxiliaryKey: ._valueDate) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDate, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .date(valueDate) + } + if let valueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDateTime, auxiliaryKey: ._valueDateTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDateTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .dateTime(valueDateTime) + } + if let valueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDecimal, auxiliaryKey: ._valueDecimal) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDecimal, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .decimal(valueDecimal) + } + if let valueId = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueId, auxiliaryKey: ._valueId) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueId, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .id(valueId) + } + if let valueInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInstant, auxiliaryKey: ._valueInstant) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInstant, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .instant(valueInstant) + } + if let valueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInteger, auxiliaryKey: ._valueInteger) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInteger, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .integer(valueInteger) + } + if let valueMarkdown = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueMarkdown, auxiliaryKey: ._valueMarkdown) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMarkdown, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .markdown(valueMarkdown) + } + if let valueOid = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueOid, auxiliaryKey: ._valueOid) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueOid, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .oid(valueOid) + } + if let valuePositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .valuePositiveInt, auxiliaryKey: ._valuePositiveInt) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePositiveInt, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .positiveInt(valuePositiveInt) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueTime, auxiliaryKey: ._valueTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .time(valueTime) + } + if let valueUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUnsignedInt, auxiliaryKey: ._valueUnsignedInt) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUnsignedInt, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .unsignedInt(valueUnsignedInt) + } + if let valueUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUri, auxiliaryKey: ._valueUri) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUri, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .uri(valueUri) + } + if let valueAddress = try Address(from: _container, forKeyIfPresent: .valueAddress) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAddress, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .address(valueAddress) + } + if let valueAge = try Age(from: _container, forKeyIfPresent: .valueAge) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAge, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .age(valueAge) + } + if let valueAnnotation = try Annotation(from: _container, forKeyIfPresent: .valueAnnotation) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAnnotation, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .annotation(valueAnnotation) + } + if let valueAttachment = try Attachment(from: _container, forKeyIfPresent: .valueAttachment) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAttachment, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .attachment(valueAttachment) + } + if let valueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .valueCodeableConcept) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .codeableConcept(valueCodeableConcept) + } + if let valueCoding = try Coding(from: _container, forKeyIfPresent: .valueCoding) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCoding, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .coding(valueCoding) + } + if let valueContactPoint = try ContactPoint(from: _container, forKeyIfPresent: .valueContactPoint) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueContactPoint, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .contactPoint(valueContactPoint) + } + if let valueCount = try Count(from: _container, forKeyIfPresent: .valueCount) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCount, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .count(valueCount) + } + if let valueDistance = try Distance(from: _container, forKeyIfPresent: .valueDistance) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDistance, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .distance(valueDistance) + } + if let valueDuration = try Duration(from: _container, forKeyIfPresent: .valueDuration) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDuration, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .duration(valueDuration) + } + if let valueHumanName = try HumanName(from: _container, forKeyIfPresent: .valueHumanName) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueHumanName, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .humanName(valueHumanName) + } + if let valueIdentifier = try Identifier(from: _container, forKeyIfPresent: .valueIdentifier) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueIdentifier, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .identifier(valueIdentifier) + } + if let valueMoney = try Money(from: _container, forKeyIfPresent: .valueMoney) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMoney, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .money(valueMoney) + } + if let valuePeriod = try Period(from: _container, forKeyIfPresent: .valuePeriod) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePeriod, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .period(valuePeriod) + } + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueRange = try Range(from: _container, forKeyIfPresent: .valueRange) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRange, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .range(valueRange) + } + if let valueRatio = try Ratio(from: _container, forKeyIfPresent: .valueRatio) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRatio, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .ratio(valueRatio) + } + if let valueReference = try Reference(from: _container, forKeyIfPresent: .valueReference) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueReference, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .reference(valueReference) + } + if let valueSampledData = try SampledData(from: _container, forKeyIfPresent: .valueSampledData) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSampledData, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .sampledData(valueSampledData) + } + if let valueSignature = try Signature(from: _container, forKeyIfPresent: .valueSignature) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSignature, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .signature(valueSignature) + } + if let valueTiming = try Timing(from: _container, forKeyIfPresent: .valueTiming) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTiming, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .timing(valueTiming) + } + if let valueMeta = try Meta(from: _container, forKeyIfPresent: .valueMeta) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMeta, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .meta(valueMeta) + } + self.value = _t_value + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try part?.encode(on: &_container, forKey: .part) + try resource?.encode(on: &_container, forKey: .resource) + if let _enum = value { + switch _enum { + case .base64Binary(let _value): + try _value.encode(on: &_container, forKey: .valueBase64Binary, auxiliaryKey: ._valueBase64Binary) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .code(let _value): + try _value.encode(on: &_container, forKey: .valueCode, auxiliaryKey: ._valueCode) + case .date(let _value): + try _value.encode(on: &_container, forKey: .valueDate, auxiliaryKey: ._valueDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .valueDateTime, auxiliaryKey: ._valueDateTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .valueDecimal, auxiliaryKey: ._valueDecimal) + case .id(let _value): + try _value.encode(on: &_container, forKey: .valueId, auxiliaryKey: ._valueId) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .valueInstant, auxiliaryKey: ._valueInstant) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .valueInteger, auxiliaryKey: ._valueInteger) + case .markdown(let _value): + try _value.encode(on: &_container, forKey: .valueMarkdown, auxiliaryKey: ._valueMarkdown) + case .oid(let _value): + try _value.encode(on: &_container, forKey: .valueOid, auxiliaryKey: ._valueOid) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .valuePositiveInt, auxiliaryKey: ._valuePositiveInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .time(let _value): + try _value.encode(on: &_container, forKey: .valueTime, auxiliaryKey: ._valueTime) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .valueUnsignedInt, auxiliaryKey: ._valueUnsignedInt) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .valueUri, auxiliaryKey: ._valueUri) + case .address(let _value): + try _value.encode(on: &_container, forKey: .valueAddress) + case .age(let _value): + try _value.encode(on: &_container, forKey: .valueAge) + case .annotation(let _value): + try _value.encode(on: &_container, forKey: .valueAnnotation) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .valueAttachment) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .valueCodeableConcept) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .valueCoding) + case .contactPoint(let _value): + try _value.encode(on: &_container, forKey: .valueContactPoint) + case .count(let _value): + try _value.encode(on: &_container, forKey: .valueCount) + case .distance(let _value): + try _value.encode(on: &_container, forKey: .valueDistance) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .valueDuration) + case .humanName(let _value): + try _value.encode(on: &_container, forKey: .valueHumanName) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .valueIdentifier) + case .money(let _value): + try _value.encode(on: &_container, forKey: .valueMoney) + case .period(let _value): + try _value.encode(on: &_container, forKey: .valuePeriod) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .valueRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .valueRatio) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueReference) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .valueSampledData) + case .signature(let _value): + try _value.encode(on: &_container, forKey: .valueSignature) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .valueTiming) + case .meta(let _value): + try _value.encode(on: &_container, forKey: .valueMeta) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ParametersParameter else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return name == _other.name + && part == _other.part + && resource == _other.resource + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(name) + hasher.combine(part) + hasher.combine(resource) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/Patient.swift b/Sources/ModelsSTU3/Patient.swift new file mode 100644 index 0000000..fd1f7dd --- /dev/null +++ b/Sources/ModelsSTU3/Patient.swift @@ -0,0 +1,704 @@ +// +// Patient.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Patient) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Information about an individual or animal receiving health care services. + + Demographics and other administrative information about an individual or animal receiving care or other health-related + services. + */ +open class Patient: DomainResource { + + override open class var resourceType: ResourceType { return .patient } + + /// All possible types for "deceased[x]" + public enum DeceasedX: Hashable { + case boolean(FHIRPrimitive) + case dateTime(FHIRPrimitive) + } + + /// All possible types for "multipleBirth[x]" + public enum MultipleBirthX: Hashable { + case boolean(FHIRPrimitive) + case integer(FHIRPrimitive) + } + + /// An identifier for this patient + public var identifier: [Identifier]? + + /// Whether this patient's record is in active use + public var active: FHIRPrimitive? + + /// A name associated with the patient + public var name: [HumanName]? + + /// A contact detail for the individual + public var telecom: [ContactPoint]? + + /// Administrative Gender - the gender that the patient is considered to have for administration and record keeping + /// purposes. + public var gender: FHIRPrimitive? + + /// The date of birth for the individual + public var birthDate: FHIRPrimitive? + + /// Indicates if the individual is deceased or not + /// One of `deceased[x]` + public var deceased: DeceasedX? + + /// Addresses for the individual + public var address: [Address]? + + /// Marital (civil) status of a patient + public var maritalStatus: CodeableConcept? + + /// Whether patient is part of a multiple birth + /// One of `multipleBirth[x]` + public var multipleBirth: MultipleBirthX? + + /// Image of the patient + public var photo: [Attachment]? + + /// A contact party (e.g. guardian, partner, friend) for the patient + public var contact: [PatientContact]? + + /// This patient is known to be an animal (non-human) + public var animal: PatientAnimal? + + /// A list of Languages which may be used to communicate with the patient about his or her health + public var communication: [PatientCommunication]? + + /// Patient's nominated primary care provider + public var generalPractitioner: [Reference]? + + /// Organization that is the custodian of the patient record + public var managingOrganization: Reference? + + /// Link to another patient resource that concerns the same actual person + public var link: [PatientLink]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + address: [Address]? = nil, + animal: PatientAnimal? = nil, + birthDate: FHIRPrimitive? = nil, + communication: [PatientCommunication]? = nil, + contact: [PatientContact]? = nil, + contained: [ResourceProxy]? = nil, + deceased: DeceasedX? = nil, + `extension`: [Extension]? = nil, + gender: FHIRPrimitive? = nil, + generalPractitioner: [Reference]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + link: [PatientLink]? = nil, + managingOrganization: Reference? = nil, + maritalStatus: CodeableConcept? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + multipleBirth: MultipleBirthX? = nil, + name: [HumanName]? = nil, + photo: [Attachment]? = nil, + telecom: [ContactPoint]? = nil, + text: Narrative? = nil) + { + self.init() + self.active = active + self.address = address + self.animal = animal + self.birthDate = birthDate + self.communication = communication + self.contact = contact + self.contained = contained + self.deceased = deceased + self.`extension` = `extension` + self.gender = gender + self.generalPractitioner = generalPractitioner + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.link = link + self.managingOrganization = managingOrganization + self.maritalStatus = maritalStatus + self.meta = meta + self.modifierExtension = modifierExtension + self.multipleBirth = multipleBirth + self.name = name + self.photo = photo + self.telecom = telecom + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case address + case animal + case birthDate; case _birthDate + case communication + case contact + case deceasedBoolean; case _deceasedBoolean + case deceasedDateTime; case _deceasedDateTime + case gender; case _gender + case generalPractitioner + case identifier + case link + case managingOrganization + case maritalStatus + case multipleBirthBoolean; case _multipleBirthBoolean + case multipleBirthInteger; case _multipleBirthInteger + case name + case photo + case telecom + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.address = try [Address](from: _container, forKeyIfPresent: .address) + self.animal = try PatientAnimal(from: _container, forKeyIfPresent: .animal) + self.birthDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .birthDate, auxiliaryKey: ._birthDate) + self.communication = try [PatientCommunication](from: _container, forKeyIfPresent: .communication) + self.contact = try [PatientContact](from: _container, forKeyIfPresent: .contact) + var _t_deceased: DeceasedX? = nil + if let deceasedBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .deceasedBoolean, auxiliaryKey: ._deceasedBoolean) { + if _t_deceased != nil { + throw DecodingError.dataCorruptedError(forKey: .deceasedBoolean, in: _container, debugDescription: "More than one value provided for \"deceased\"") + } + _t_deceased = .boolean(deceasedBoolean) + } + if let deceasedDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .deceasedDateTime, auxiliaryKey: ._deceasedDateTime) { + if _t_deceased != nil { + throw DecodingError.dataCorruptedError(forKey: .deceasedDateTime, in: _container, debugDescription: "More than one value provided for \"deceased\"") + } + _t_deceased = .dateTime(deceasedDateTime) + } + self.deceased = _t_deceased + self.gender = try FHIRPrimitive(from: _container, forKeyIfPresent: .gender, auxiliaryKey: ._gender) + self.generalPractitioner = try [Reference](from: _container, forKeyIfPresent: .generalPractitioner) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.link = try [PatientLink](from: _container, forKeyIfPresent: .link) + self.managingOrganization = try Reference(from: _container, forKeyIfPresent: .managingOrganization) + self.maritalStatus = try CodeableConcept(from: _container, forKeyIfPresent: .maritalStatus) + var _t_multipleBirth: MultipleBirthX? = nil + if let multipleBirthBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .multipleBirthBoolean, auxiliaryKey: ._multipleBirthBoolean) { + if _t_multipleBirth != nil { + throw DecodingError.dataCorruptedError(forKey: .multipleBirthBoolean, in: _container, debugDescription: "More than one value provided for \"multipleBirth\"") + } + _t_multipleBirth = .boolean(multipleBirthBoolean) + } + if let multipleBirthInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .multipleBirthInteger, auxiliaryKey: ._multipleBirthInteger) { + if _t_multipleBirth != nil { + throw DecodingError.dataCorruptedError(forKey: .multipleBirthInteger, in: _container, debugDescription: "More than one value provided for \"multipleBirth\"") + } + _t_multipleBirth = .integer(multipleBirthInteger) + } + self.multipleBirth = _t_multipleBirth + self.name = try [HumanName](from: _container, forKeyIfPresent: .name) + self.photo = try [Attachment](from: _container, forKeyIfPresent: .photo) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try address?.encode(on: &_container, forKey: .address) + try animal?.encode(on: &_container, forKey: .animal) + try birthDate?.encode(on: &_container, forKey: .birthDate, auxiliaryKey: ._birthDate) + try communication?.encode(on: &_container, forKey: .communication) + try contact?.encode(on: &_container, forKey: .contact) + if let _enum = deceased { + switch _enum { + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .deceasedBoolean, auxiliaryKey: ._deceasedBoolean) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .deceasedDateTime, auxiliaryKey: ._deceasedDateTime) + } + } + try gender?.encode(on: &_container, forKey: .gender, auxiliaryKey: ._gender) + try generalPractitioner?.encode(on: &_container, forKey: .generalPractitioner) + try identifier?.encode(on: &_container, forKey: .identifier) + try link?.encode(on: &_container, forKey: .link) + try managingOrganization?.encode(on: &_container, forKey: .managingOrganization) + try maritalStatus?.encode(on: &_container, forKey: .maritalStatus) + if let _enum = multipleBirth { + switch _enum { + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .multipleBirthBoolean, auxiliaryKey: ._multipleBirthBoolean) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .multipleBirthInteger, auxiliaryKey: ._multipleBirthInteger) + } + } + try name?.encode(on: &_container, forKey: .name) + try photo?.encode(on: &_container, forKey: .photo) + try telecom?.encode(on: &_container, forKey: .telecom) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Patient else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && address == _other.address + && animal == _other.animal + && birthDate == _other.birthDate + && communication == _other.communication + && contact == _other.contact + && deceased == _other.deceased + && gender == _other.gender + && generalPractitioner == _other.generalPractitioner + && identifier == _other.identifier + && link == _other.link + && managingOrganization == _other.managingOrganization + && maritalStatus == _other.maritalStatus + && multipleBirth == _other.multipleBirth + && name == _other.name + && photo == _other.photo + && telecom == _other.telecom + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(address) + hasher.combine(animal) + hasher.combine(birthDate) + hasher.combine(communication) + hasher.combine(contact) + hasher.combine(deceased) + hasher.combine(gender) + hasher.combine(generalPractitioner) + hasher.combine(identifier) + hasher.combine(link) + hasher.combine(managingOrganization) + hasher.combine(maritalStatus) + hasher.combine(multipleBirth) + hasher.combine(name) + hasher.combine(photo) + hasher.combine(telecom) + } +} + +/** + This patient is known to be an animal (non-human). + + This patient is known to be an animal. + */ +open class PatientAnimal: BackboneElement { + + /// E.g. Dog, Cow + public var species: CodeableConcept + + /// E.g. Poodle, Angus + public var breed: CodeableConcept? + + /// E.g. Neutered, Intact + public var genderStatus: CodeableConcept? + + /// Designated initializer taking all required properties + public init(species: CodeableConcept) { + self.species = species + super.init() + } + + /// Convenience initializer + public convenience init( + breed: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + genderStatus: CodeableConcept? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + species: CodeableConcept) + { + self.init(species: species) + self.breed = breed + self.`extension` = `extension` + self.genderStatus = genderStatus + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case breed + case genderStatus + case species + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.breed = try CodeableConcept(from: _container, forKeyIfPresent: .breed) + self.genderStatus = try CodeableConcept(from: _container, forKeyIfPresent: .genderStatus) + self.species = try CodeableConcept(from: _container, forKey: .species) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try breed?.encode(on: &_container, forKey: .breed) + try genderStatus?.encode(on: &_container, forKey: .genderStatus) + try species.encode(on: &_container, forKey: .species) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PatientAnimal else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return breed == _other.breed + && genderStatus == _other.genderStatus + && species == _other.species + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(breed) + hasher.combine(genderStatus) + hasher.combine(species) + } +} + +/** + A list of Languages which may be used to communicate with the patient about his or her health. + + Languages which may be used to communicate with the patient about his or her health. + */ +open class PatientCommunication: BackboneElement { + + /// The language which can be used to communicate with the patient about his or her health + public var language: CodeableConcept + + /// Language preference indicator + public var preferred: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(language: CodeableConcept) { + self.language = language + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + language: CodeableConcept, + modifierExtension: [Extension]? = nil, + preferred: FHIRPrimitive? = nil) + { + self.init(language: language) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.preferred = preferred + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case language + case preferred; case _preferred + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.language = try CodeableConcept(from: _container, forKey: .language) + self.preferred = try FHIRPrimitive(from: _container, forKeyIfPresent: .preferred, auxiliaryKey: ._preferred) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try language.encode(on: &_container, forKey: .language) + try preferred?.encode(on: &_container, forKey: .preferred, auxiliaryKey: ._preferred) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PatientCommunication else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return language == _other.language + && preferred == _other.preferred + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(language) + hasher.combine(preferred) + } +} + +/** + A contact party (e.g. guardian, partner, friend) for the patient. + */ +open class PatientContact: BackboneElement { + + /// The kind of relationship + public var relationship: [CodeableConcept]? + + /// A name associated with the contact person + public var name: HumanName? + + /// A contact detail for the person + public var telecom: [ContactPoint]? + + /// Address for the contact person + public var address: Address? + + /// Administrative Gender - the gender that the contact person is considered to have for administration and record + /// keeping purposes. + public var gender: FHIRPrimitive? + + /// Organization that is associated with the contact + public var organization: Reference? + + /// The period during which this contact person or organization is valid to be contacted relating to this patient + public var period: Period? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + address: Address? = nil, + `extension`: [Extension]? = nil, + gender: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: HumanName? = nil, + organization: Reference? = nil, + period: Period? = nil, + relationship: [CodeableConcept]? = nil, + telecom: [ContactPoint]? = nil) + { + self.init() + self.address = address + self.`extension` = `extension` + self.gender = gender + self.id = id + self.modifierExtension = modifierExtension + self.name = name + self.organization = organization + self.period = period + self.relationship = relationship + self.telecom = telecom + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case address + case gender; case _gender + case name + case organization + case period + case relationship + case telecom + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.address = try Address(from: _container, forKeyIfPresent: .address) + self.gender = try FHIRPrimitive(from: _container, forKeyIfPresent: .gender, auxiliaryKey: ._gender) + self.name = try HumanName(from: _container, forKeyIfPresent: .name) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.relationship = try [CodeableConcept](from: _container, forKeyIfPresent: .relationship) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try address?.encode(on: &_container, forKey: .address) + try gender?.encode(on: &_container, forKey: .gender, auxiliaryKey: ._gender) + try name?.encode(on: &_container, forKey: .name) + try organization?.encode(on: &_container, forKey: .organization) + try period?.encode(on: &_container, forKey: .period) + try relationship?.encode(on: &_container, forKey: .relationship) + try telecom?.encode(on: &_container, forKey: .telecom) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PatientContact else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return address == _other.address + && gender == _other.gender + && name == _other.name + && organization == _other.organization + && period == _other.period + && relationship == _other.relationship + && telecom == _other.telecom + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(address) + hasher.combine(gender) + hasher.combine(name) + hasher.combine(organization) + hasher.combine(period) + hasher.combine(relationship) + hasher.combine(telecom) + } +} + +/** + Link to another patient resource that concerns the same actual person. + + Link to another patient resource that concerns the same actual patient. + */ +open class PatientLink: BackboneElement { + + /// The other patient or related person resource that the link refers to + public var other: Reference + + /// The type of link between this patient resource and another patient resource. + public var type: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(other: Reference, type: FHIRPrimitive) { + self.other = other + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + other: Reference, + type: FHIRPrimitive) + { + self.init(other: other, type: type) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case other + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.other = try Reference(from: _container, forKey: .other) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try other.encode(on: &_container, forKey: .other) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PatientLink else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return other == _other.other + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(other) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/PaymentNotice.swift b/Sources/ModelsSTU3/PaymentNotice.swift new file mode 100644 index 0000000..765fe27 --- /dev/null +++ b/Sources/ModelsSTU3/PaymentNotice.swift @@ -0,0 +1,194 @@ +// +// PaymentNotice.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/PaymentNotice) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + PaymentNotice request. + + This resource provides the status of the payment for goods and services rendered, and the request and response resource + references. + */ +open class PaymentNotice: DomainResource { + + override open class var resourceType: ResourceType { return .paymentNotice } + + /// Business Identifier + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// Request reference + public var request: Reference? + + /// Response reference + public var response: Reference? + + /// Payment or clearing date + public var statusDate: FHIRPrimitive? + + /// Creation date + public var created: FHIRPrimitive? + + /// Insurer or Regulatory body + public var target: Reference? + + /// Responsible practitioner + public var provider: Reference? + + /// Responsible organization + public var organization: Reference? + + /// Whether payment has been sent or cleared + public var paymentStatus: CodeableConcept? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + organization: Reference? = nil, + paymentStatus: CodeableConcept? = nil, + provider: Reference? = nil, + request: Reference? = nil, + response: Reference? = nil, + status: FHIRPrimitive? = nil, + statusDate: FHIRPrimitive? = nil, + target: Reference? = nil, + text: Narrative? = nil) + { + self.init() + self.contained = contained + self.created = created + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.organization = organization + self.paymentStatus = paymentStatus + self.provider = provider + self.request = request + self.response = response + self.status = status + self.statusDate = statusDate + self.target = target + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case created; case _created + case identifier + case organization + case paymentStatus + case provider + case request + case response + case status; case _status + case statusDate; case _statusDate + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.paymentStatus = try CodeableConcept(from: _container, forKeyIfPresent: .paymentStatus) + self.provider = try Reference(from: _container, forKeyIfPresent: .provider) + self.request = try Reference(from: _container, forKeyIfPresent: .request) + self.response = try Reference(from: _container, forKeyIfPresent: .response) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.statusDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .statusDate, auxiliaryKey: ._statusDate) + self.target = try Reference(from: _container, forKeyIfPresent: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try identifier?.encode(on: &_container, forKey: .identifier) + try organization?.encode(on: &_container, forKey: .organization) + try paymentStatus?.encode(on: &_container, forKey: .paymentStatus) + try provider?.encode(on: &_container, forKey: .provider) + try request?.encode(on: &_container, forKey: .request) + try response?.encode(on: &_container, forKey: .response) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try statusDate?.encode(on: &_container, forKey: .statusDate, auxiliaryKey: ._statusDate) + try target?.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PaymentNotice else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return created == _other.created + && identifier == _other.identifier + && organization == _other.organization + && paymentStatus == _other.paymentStatus + && provider == _other.provider + && request == _other.request + && response == _other.response + && status == _other.status + && statusDate == _other.statusDate + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(created) + hasher.combine(identifier) + hasher.combine(organization) + hasher.combine(paymentStatus) + hasher.combine(provider) + hasher.combine(request) + hasher.combine(response) + hasher.combine(status) + hasher.combine(statusDate) + hasher.combine(target) + } +} diff --git a/Sources/ModelsSTU3/PaymentReconciliation.swift b/Sources/ModelsSTU3/PaymentReconciliation.swift new file mode 100644 index 0000000..92277c6 --- /dev/null +++ b/Sources/ModelsSTU3/PaymentReconciliation.swift @@ -0,0 +1,445 @@ +// +// PaymentReconciliation.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + PaymentReconciliation resource. + + This resource provides payment details and claim references supporting a bulk payment. + */ +open class PaymentReconciliation: DomainResource { + + override open class var resourceType: ResourceType { return .paymentReconciliation } + + /// Business Identifier + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// Period covered + public var period: Period? + + /// Creation date + public var created: FHIRPrimitive? + + /// Insurer + public var organization: Reference? + + /// Claim reference + public var request: Reference? + + /// complete | error | partial + public var outcome: CodeableConcept? + + /// Disposition Message + public var disposition: FHIRPrimitive? + + /// Responsible practitioner + public var requestProvider: Reference? + + /// Responsible organization + public var requestOrganization: Reference? + + /// List of settlements + public var detail: [PaymentReconciliationDetail]? + + /// Printed Form Identifier + public var form: CodeableConcept? + + /// Total amount of Payment + public var total: Money? + + /// Processing comments + public var processNote: [PaymentReconciliationProcessNote]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + detail: [PaymentReconciliationDetail]? = nil, + disposition: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + form: CodeableConcept? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + organization: Reference? = nil, + outcome: CodeableConcept? = nil, + period: Period? = nil, + processNote: [PaymentReconciliationProcessNote]? = nil, + request: Reference? = nil, + requestOrganization: Reference? = nil, + requestProvider: Reference? = nil, + status: FHIRPrimitive? = nil, + text: Narrative? = nil, + total: Money? = nil) + { + self.init() + self.contained = contained + self.created = created + self.detail = detail + self.disposition = disposition + self.`extension` = `extension` + self.form = form + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.organization = organization + self.outcome = outcome + self.period = period + self.processNote = processNote + self.request = request + self.requestOrganization = requestOrganization + self.requestProvider = requestProvider + self.status = status + self.text = text + self.total = total + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case created; case _created + case detail + case disposition; case _disposition + case form + case identifier + case organization + case outcome + case period + case processNote + case request + case requestOrganization + case requestProvider + case status; case _status + case total + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.detail = try [PaymentReconciliationDetail](from: _container, forKeyIfPresent: .detail) + self.disposition = try FHIRPrimitive(from: _container, forKeyIfPresent: .disposition, auxiliaryKey: ._disposition) + self.form = try CodeableConcept(from: _container, forKeyIfPresent: .form) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.outcome = try CodeableConcept(from: _container, forKeyIfPresent: .outcome) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.processNote = try [PaymentReconciliationProcessNote](from: _container, forKeyIfPresent: .processNote) + self.request = try Reference(from: _container, forKeyIfPresent: .request) + self.requestOrganization = try Reference(from: _container, forKeyIfPresent: .requestOrganization) + self.requestProvider = try Reference(from: _container, forKeyIfPresent: .requestProvider) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.total = try Money(from: _container, forKeyIfPresent: .total) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try detail?.encode(on: &_container, forKey: .detail) + try disposition?.encode(on: &_container, forKey: .disposition, auxiliaryKey: ._disposition) + try form?.encode(on: &_container, forKey: .form) + try identifier?.encode(on: &_container, forKey: .identifier) + try organization?.encode(on: &_container, forKey: .organization) + try outcome?.encode(on: &_container, forKey: .outcome) + try period?.encode(on: &_container, forKey: .period) + try processNote?.encode(on: &_container, forKey: .processNote) + try request?.encode(on: &_container, forKey: .request) + try requestOrganization?.encode(on: &_container, forKey: .requestOrganization) + try requestProvider?.encode(on: &_container, forKey: .requestProvider) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try total?.encode(on: &_container, forKey: .total) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PaymentReconciliation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return created == _other.created + && detail == _other.detail + && disposition == _other.disposition + && form == _other.form + && identifier == _other.identifier + && organization == _other.organization + && outcome == _other.outcome + && period == _other.period + && processNote == _other.processNote + && request == _other.request + && requestOrganization == _other.requestOrganization + && requestProvider == _other.requestProvider + && status == _other.status + && total == _other.total + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(created) + hasher.combine(detail) + hasher.combine(disposition) + hasher.combine(form) + hasher.combine(identifier) + hasher.combine(organization) + hasher.combine(outcome) + hasher.combine(period) + hasher.combine(processNote) + hasher.combine(request) + hasher.combine(requestOrganization) + hasher.combine(requestProvider) + hasher.combine(status) + hasher.combine(total) + } +} + +/** + List of settlements. + + List of individual settlement amounts and the corresponding transaction. + */ +open class PaymentReconciliationDetail: BackboneElement { + + /// Type code + public var type: CodeableConcept + + /// Claim + public var request: Reference? + + /// Claim Response + public var response: Reference? + + /// Organization which submitted the claim + public var submitter: Reference? + + /// Organization which is receiving the payment + public var payee: Reference? + + /// Invoice date + public var date: FHIRPrimitive? + + /// Amount being paid + public var amount: Money? + + /// Designated initializer taking all required properties + public init(type: CodeableConcept) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + amount: Money? = nil, + date: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + payee: Reference? = nil, + request: Reference? = nil, + response: Reference? = nil, + submitter: Reference? = nil, + type: CodeableConcept) + { + self.init(type: type) + self.amount = amount + self.date = date + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.payee = payee + self.request = request + self.response = response + self.submitter = submitter + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case amount + case date; case _date + case payee + case request + case response + case submitter + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.amount = try Money(from: _container, forKeyIfPresent: .amount) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.payee = try Reference(from: _container, forKeyIfPresent: .payee) + self.request = try Reference(from: _container, forKeyIfPresent: .request) + self.response = try Reference(from: _container, forKeyIfPresent: .response) + self.submitter = try Reference(from: _container, forKeyIfPresent: .submitter) + self.type = try CodeableConcept(from: _container, forKey: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try amount?.encode(on: &_container, forKey: .amount) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try payee?.encode(on: &_container, forKey: .payee) + try request?.encode(on: &_container, forKey: .request) + try response?.encode(on: &_container, forKey: .response) + try submitter?.encode(on: &_container, forKey: .submitter) + try type.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PaymentReconciliationDetail else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return amount == _other.amount + && date == _other.date + && payee == _other.payee + && request == _other.request + && response == _other.response + && submitter == _other.submitter + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(amount) + hasher.combine(date) + hasher.combine(payee) + hasher.combine(request) + hasher.combine(response) + hasher.combine(submitter) + hasher.combine(type) + } +} + +/** + Processing comments. + + Suite of notes. + */ +open class PaymentReconciliationProcessNote: BackboneElement { + + /// display | print | printoper + public var type: CodeableConcept? + + /// Comment on the processing + public var text: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + text: FHIRPrimitive? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case text; case _text + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PaymentReconciliationProcessNote else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return text == _other.text + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(text) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/Period.swift b/Sources/ModelsSTU3/Period.swift new file mode 100644 index 0000000..0a126be --- /dev/null +++ b/Sources/ModelsSTU3/Period.swift @@ -0,0 +1,99 @@ +// +// Period.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Period) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Time range defined by start and end date/time. + + A time period defined by a start and end date and optionally time. + */ +open class Period: Element { + + /// Starting time with inclusive boundary + public var start: FHIRPrimitive? + + /// End time with inclusive boundary, if not ongoing + public var end: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + end: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + start: FHIRPrimitive? = nil) + { + self.init() + self.end = end + self.`extension` = `extension` + self.id = id + self.start = start + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case end; case _end + case start; case _start + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.end = try FHIRPrimitive(from: _container, forKeyIfPresent: .end, auxiliaryKey: ._end) + self.start = try FHIRPrimitive(from: _container, forKeyIfPresent: .start, auxiliaryKey: ._start) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try end?.encode(on: &_container, forKey: .end, auxiliaryKey: ._end) + try start?.encode(on: &_container, forKey: .start, auxiliaryKey: ._start) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Period else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return end == _other.end + && start == _other.start + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(end) + hasher.combine(start) + } +} diff --git a/Sources/ModelsSTU3/Person.swift b/Sources/ModelsSTU3/Person.swift new file mode 100644 index 0000000..881942a --- /dev/null +++ b/Sources/ModelsSTU3/Person.swift @@ -0,0 +1,272 @@ +// +// Person.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Person) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A generic person record. + + Demographics and administrative information about a person independent of a specific health-related context. + */ +open class Person: DomainResource { + + override open class var resourceType: ResourceType { return .person } + + /// A human identifier for this person + public var identifier: [Identifier]? + + /// A name associated with the person + public var name: [HumanName]? + + /// A contact detail for the person + public var telecom: [ContactPoint]? + + /// Administrative Gender. + public var gender: FHIRPrimitive? + + /// The date on which the person was born + public var birthDate: FHIRPrimitive? + + /// One or more addresses for the person + public var address: [Address]? + + /// Image of the person + public var photo: Attachment? + + /// The organization that is the custodian of the person record + public var managingOrganization: Reference? + + /// This person's record is in active use + public var active: FHIRPrimitive? + + /// Link to a resource that concerns the same actual person + public var link: [PersonLink]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + address: [Address]? = nil, + birthDate: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + gender: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + link: [PersonLink]? = nil, + managingOrganization: Reference? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: [HumanName]? = nil, + photo: Attachment? = nil, + telecom: [ContactPoint]? = nil, + text: Narrative? = nil) + { + self.init() + self.active = active + self.address = address + self.birthDate = birthDate + self.contained = contained + self.`extension` = `extension` + self.gender = gender + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.link = link + self.managingOrganization = managingOrganization + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.photo = photo + self.telecom = telecom + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case address + case birthDate; case _birthDate + case gender; case _gender + case identifier + case link + case managingOrganization + case name + case photo + case telecom + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.address = try [Address](from: _container, forKeyIfPresent: .address) + self.birthDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .birthDate, auxiliaryKey: ._birthDate) + self.gender = try FHIRPrimitive(from: _container, forKeyIfPresent: .gender, auxiliaryKey: ._gender) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.link = try [PersonLink](from: _container, forKeyIfPresent: .link) + self.managingOrganization = try Reference(from: _container, forKeyIfPresent: .managingOrganization) + self.name = try [HumanName](from: _container, forKeyIfPresent: .name) + self.photo = try Attachment(from: _container, forKeyIfPresent: .photo) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try address?.encode(on: &_container, forKey: .address) + try birthDate?.encode(on: &_container, forKey: .birthDate, auxiliaryKey: ._birthDate) + try gender?.encode(on: &_container, forKey: .gender, auxiliaryKey: ._gender) + try identifier?.encode(on: &_container, forKey: .identifier) + try link?.encode(on: &_container, forKey: .link) + try managingOrganization?.encode(on: &_container, forKey: .managingOrganization) + try name?.encode(on: &_container, forKey: .name) + try photo?.encode(on: &_container, forKey: .photo) + try telecom?.encode(on: &_container, forKey: .telecom) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Person else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && address == _other.address + && birthDate == _other.birthDate + && gender == _other.gender + && identifier == _other.identifier + && link == _other.link + && managingOrganization == _other.managingOrganization + && name == _other.name + && photo == _other.photo + && telecom == _other.telecom + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(address) + hasher.combine(birthDate) + hasher.combine(gender) + hasher.combine(identifier) + hasher.combine(link) + hasher.combine(managingOrganization) + hasher.combine(name) + hasher.combine(photo) + hasher.combine(telecom) + } +} + +/** + Link to a resource that concerns the same actual person. + */ +open class PersonLink: BackboneElement { + + /// The resource to which this actual person is associated + public var target: Reference + + /// Level of assurance that this link is actually associated with the target resource. + public var assurance: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(target: Reference) { + self.target = target + super.init() + } + + /// Convenience initializer + public convenience init( + assurance: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + target: Reference) + { + self.init(target: target) + self.assurance = assurance + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case assurance; case _assurance + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.assurance = try FHIRPrimitive(from: _container, forKeyIfPresent: .assurance, auxiliaryKey: ._assurance) + self.target = try Reference(from: _container, forKey: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try assurance?.encode(on: &_container, forKey: .assurance, auxiliaryKey: ._assurance) + try target.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PersonLink else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return assurance == _other.assurance + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(assurance) + hasher.combine(target) + } +} diff --git a/Sources/ModelsSTU3/PlanDefinition.swift b/Sources/ModelsSTU3/PlanDefinition.swift new file mode 100644 index 0000000..0ea3208 --- /dev/null +++ b/Sources/ModelsSTU3/PlanDefinition.swift @@ -0,0 +1,1389 @@ +// +// PlanDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/PlanDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + The definition of a plan for a series of actions, independent of any specific patient or context. + + This resource allows for the definition of various types of plans as a sharable, consumable, and executable artifact. + The resource is general enough to support the description of a broad range of clinical artifacts such as clinical + decision support rules, order sets and protocols. + */ +open class PlanDefinition: DomainResource { + + override open class var resourceType: ResourceType { return .planDefinition } + + /// Logical URI to reference this plan definition (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the plan definition + public var identifier: [Identifier]? + + /// Business version of the plan definition + public var version: FHIRPrimitive? + + /// Name for this plan definition (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this plan definition (human friendly) + public var title: FHIRPrimitive? + + /// order-set | protocol | eca-rule + public var type: CodeableConcept? + + /// The status of this plan definition. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Natural language description of the plan definition + public var description_fhir: FHIRPrimitive? + + /// Why this plan definition is defined + public var purpose: FHIRPrimitive? + + /// Describes the clinical usage of the asset + public var usage: FHIRPrimitive? + + /// When the plan definition was approved by publisher + public var approvalDate: FHIRPrimitive? + + /// When the plan definition was last reviewed + public var lastReviewDate: FHIRPrimitive? + + /// When the plan definition is expected to be used + public var effectivePeriod: Period? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for plan definition (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// E.g. Education, Treatment, Assessment, etc + public var topic: [CodeableConcept]? + + /// A content contributor + public var contributor: [Contributor]? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Related artifacts for the asset + public var relatedArtifact: [RelatedArtifact]? + + /// Logic used by the plan definition + public var library: [Reference]? + + /// What the plan is trying to accomplish + public var goal: [PlanDefinitionGoal]? + + /// Action defined by the plan + public var action: [PlanDefinitionAction]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + action: [PlanDefinitionAction]? = nil, + approvalDate: FHIRPrimitive? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + contributor: [Contributor]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + effectivePeriod: Period? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + goal: [PlanDefinitionGoal]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + lastReviewDate: FHIRPrimitive? = nil, + library: [Reference]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + relatedArtifact: [RelatedArtifact]? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + topic: [CodeableConcept]? = nil, + type: CodeableConcept? = nil, + url: FHIRPrimitive? = nil, + usage: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(status: status) + self.action = action + self.approvalDate = approvalDate + self.contact = contact + self.contained = contained + self.contributor = contributor + self.copyright = copyright + self.date = date + self.description_fhir = description_fhir + self.effectivePeriod = effectivePeriod + self.experimental = experimental + self.`extension` = `extension` + self.goal = goal + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.lastReviewDate = lastReviewDate + self.library = library + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.publisher = publisher + self.purpose = purpose + self.relatedArtifact = relatedArtifact + self.text = text + self.title = title + self.topic = topic + self.type = type + self.url = url + self.usage = usage + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case approvalDate; case _approvalDate + case contact + case contributor + case copyright; case _copyright + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case effectivePeriod + case experimental; case _experimental + case goal + case identifier + case jurisdiction + case lastReviewDate; case _lastReviewDate + case library + case name; case _name + case publisher; case _publisher + case purpose; case _purpose + case relatedArtifact + case status; case _status + case title; case _title + case topic + case type + case url; case _url + case usage; case _usage + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [PlanDefinitionAction](from: _container, forKeyIfPresent: .action) + self.approvalDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .approvalDate, auxiliaryKey: ._approvalDate) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.contributor = try [Contributor](from: _container, forKeyIfPresent: .contributor) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.goal = try [PlanDefinitionGoal](from: _container, forKeyIfPresent: .goal) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.lastReviewDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + self.library = try [Reference](from: _container, forKeyIfPresent: .library) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.relatedArtifact = try [RelatedArtifact](from: _container, forKeyIfPresent: .relatedArtifact) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.topic = try [CodeableConcept](from: _container, forKeyIfPresent: .topic) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.usage = try FHIRPrimitive(from: _container, forKeyIfPresent: .usage, auxiliaryKey: ._usage) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action) + try approvalDate?.encode(on: &_container, forKey: .approvalDate, auxiliaryKey: ._approvalDate) + try contact?.encode(on: &_container, forKey: .contact) + try contributor?.encode(on: &_container, forKey: .contributor) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try effectivePeriod?.encode(on: &_container, forKey: .effectivePeriod) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try goal?.encode(on: &_container, forKey: .goal) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try lastReviewDate?.encode(on: &_container, forKey: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + try library?.encode(on: &_container, forKey: .library) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try relatedArtifact?.encode(on: &_container, forKey: .relatedArtifact) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try topic?.encode(on: &_container, forKey: .topic) + try type?.encode(on: &_container, forKey: .type) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try usage?.encode(on: &_container, forKey: .usage, auxiliaryKey: ._usage) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PlanDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && approvalDate == _other.approvalDate + && contact == _other.contact + && contributor == _other.contributor + && copyright == _other.copyright + && date == _other.date + && description_fhir == _other.description_fhir + && effectivePeriod == _other.effectivePeriod + && experimental == _other.experimental + && goal == _other.goal + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && lastReviewDate == _other.lastReviewDate + && library == _other.library + && name == _other.name + && publisher == _other.publisher + && purpose == _other.purpose + && relatedArtifact == _other.relatedArtifact + && status == _other.status + && title == _other.title + && topic == _other.topic + && type == _other.type + && url == _other.url + && usage == _other.usage + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(approvalDate) + hasher.combine(contact) + hasher.combine(contributor) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(effectivePeriod) + hasher.combine(experimental) + hasher.combine(goal) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(lastReviewDate) + hasher.combine(library) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(relatedArtifact) + hasher.combine(status) + hasher.combine(title) + hasher.combine(topic) + hasher.combine(type) + hasher.combine(url) + hasher.combine(usage) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Action defined by the plan. + + An action to be taken as part of the plan. + */ +open class PlanDefinitionAction: BackboneElement { + + /// All possible types for "timing[x]" + public enum TimingX: Hashable { + case dateTime(FHIRPrimitive) + case duration(Duration) + case period(Period) + case range(Range) + case timing(Timing) + } + + /// User-visible label for the action (e.g. 1. or A.) + public var label: FHIRPrimitive? + + /// User-visible title + public var title: FHIRPrimitive? + + /// Short description of the action + public var description_fhir: FHIRPrimitive? + + /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system + public var textEquivalent: FHIRPrimitive? + + /// Code representing the meaning of the action or sub-actions + public var code: [CodeableConcept]? + + /// Why the action should be performed + public var reason: [CodeableConcept]? + + /// Supporting documentation for the intended performer of the action + public var documentation: [RelatedArtifact]? + + /// What goals this action supports + public var goalId: [FHIRPrimitive]? + + /// When the action should be triggered + public var triggerDefinition: [TriggerDefinition]? + + /// Whether or not the action is applicable + public var condition: [PlanDefinitionActionCondition]? + + /// Input data requirements + public var input: [DataRequirement]? + + /// Output data definition + public var output: [DataRequirement]? + + /// Relationship to another action + public var relatedAction: [PlanDefinitionActionRelatedAction]? + + /// When the action should take place + /// One of `timing[x]` + public var timing: TimingX? + + /// Who should participate in the action + public var participant: [PlanDefinitionActionParticipant]? + + /// create | update | remove | fire-event + public var type: Coding? + + /// Defines the grouping behavior for the action and its children. + public var groupingBehavior: FHIRPrimitive? + + /// Defines the selection behavior for the action and its children. + public var selectionBehavior: FHIRPrimitive? + + /// Defines the requiredness behavior for the action. + public var requiredBehavior: FHIRPrimitive? + + /// Defines whether the action should usually be preselected. + public var precheckBehavior: FHIRPrimitive? + + /// Defines whether the action can be selected multiple times. + public var cardinalityBehavior: FHIRPrimitive? + + /// Description of the activity to be performed + public var definition: Reference? + + /// Transform to apply the template + public var transform: Reference? + + /// Dynamic aspects of the definition + public var dynamicValue: [PlanDefinitionActionDynamicValue]? + + /// A sub-action + public var action: [PlanDefinitionAction]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + action: [PlanDefinitionAction]? = nil, + cardinalityBehavior: FHIRPrimitive? = nil, + code: [CodeableConcept]? = nil, + condition: [PlanDefinitionActionCondition]? = nil, + definition: Reference? = nil, + description_fhir: FHIRPrimitive? = nil, + documentation: [RelatedArtifact]? = nil, + dynamicValue: [PlanDefinitionActionDynamicValue]? = nil, + `extension`: [Extension]? = nil, + goalId: [FHIRPrimitive]? = nil, + groupingBehavior: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + input: [DataRequirement]? = nil, + label: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + output: [DataRequirement]? = nil, + participant: [PlanDefinitionActionParticipant]? = nil, + precheckBehavior: FHIRPrimitive? = nil, + reason: [CodeableConcept]? = nil, + relatedAction: [PlanDefinitionActionRelatedAction]? = nil, + requiredBehavior: FHIRPrimitive? = nil, + selectionBehavior: FHIRPrimitive? = nil, + textEquivalent: FHIRPrimitive? = nil, + timing: TimingX? = nil, + title: FHIRPrimitive? = nil, + transform: Reference? = nil, + triggerDefinition: [TriggerDefinition]? = nil, + type: Coding? = nil) + { + self.init() + self.action = action + self.cardinalityBehavior = cardinalityBehavior + self.code = code + self.condition = condition + self.definition = definition + self.description_fhir = description_fhir + self.documentation = documentation + self.dynamicValue = dynamicValue + self.`extension` = `extension` + self.goalId = goalId + self.groupingBehavior = groupingBehavior + self.id = id + self.input = input + self.label = label + self.modifierExtension = modifierExtension + self.output = output + self.participant = participant + self.precheckBehavior = precheckBehavior + self.reason = reason + self.relatedAction = relatedAction + self.requiredBehavior = requiredBehavior + self.selectionBehavior = selectionBehavior + self.textEquivalent = textEquivalent + self.timing = timing + self.title = title + self.transform = transform + self.triggerDefinition = triggerDefinition + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case cardinalityBehavior; case _cardinalityBehavior + case code + case condition + case definition + case description_fhir = "description"; case _description_fhir = "_description" + case documentation + case dynamicValue + case goalId; case _goalId + case groupingBehavior; case _groupingBehavior + case input + case label; case _label + case output + case participant + case precheckBehavior; case _precheckBehavior + case reason + case relatedAction + case requiredBehavior; case _requiredBehavior + case selectionBehavior; case _selectionBehavior + case textEquivalent; case _textEquivalent + case timingDateTime; case _timingDateTime + case timingDuration + case timingPeriod + case timingRange + case timingTiming + case title; case _title + case transform + case triggerDefinition + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [PlanDefinitionAction](from: _container, forKeyIfPresent: .action) + self.cardinalityBehavior = try FHIRPrimitive(from: _container, forKeyIfPresent: .cardinalityBehavior, auxiliaryKey: ._cardinalityBehavior) + self.code = try [CodeableConcept](from: _container, forKeyIfPresent: .code) + self.condition = try [PlanDefinitionActionCondition](from: _container, forKeyIfPresent: .condition) + self.definition = try Reference(from: _container, forKeyIfPresent: .definition) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.documentation = try [RelatedArtifact](from: _container, forKeyIfPresent: .documentation) + self.dynamicValue = try [PlanDefinitionActionDynamicValue](from: _container, forKeyIfPresent: .dynamicValue) + self.goalId = try [FHIRPrimitive](from: _container, forKeyIfPresent: .goalId, auxiliaryKey: ._goalId) + self.groupingBehavior = try FHIRPrimitive(from: _container, forKeyIfPresent: .groupingBehavior, auxiliaryKey: ._groupingBehavior) + self.input = try [DataRequirement](from: _container, forKeyIfPresent: .input) + self.label = try FHIRPrimitive(from: _container, forKeyIfPresent: .label, auxiliaryKey: ._label) + self.output = try [DataRequirement](from: _container, forKeyIfPresent: .output) + self.participant = try [PlanDefinitionActionParticipant](from: _container, forKeyIfPresent: .participant) + self.precheckBehavior = try FHIRPrimitive(from: _container, forKeyIfPresent: .precheckBehavior, auxiliaryKey: ._precheckBehavior) + self.reason = try [CodeableConcept](from: _container, forKeyIfPresent: .reason) + self.relatedAction = try [PlanDefinitionActionRelatedAction](from: _container, forKeyIfPresent: .relatedAction) + self.requiredBehavior = try FHIRPrimitive(from: _container, forKeyIfPresent: .requiredBehavior, auxiliaryKey: ._requiredBehavior) + self.selectionBehavior = try FHIRPrimitive(from: _container, forKeyIfPresent: .selectionBehavior, auxiliaryKey: ._selectionBehavior) + self.textEquivalent = try FHIRPrimitive(from: _container, forKeyIfPresent: .textEquivalent, auxiliaryKey: ._textEquivalent) + var _t_timing: TimingX? = nil + if let timingDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .timingDateTime, auxiliaryKey: ._timingDateTime) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingDateTime, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .dateTime(timingDateTime) + } + if let timingPeriod = try Period(from: _container, forKeyIfPresent: .timingPeriod) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingPeriod, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .period(timingPeriod) + } + if let timingDuration = try Duration(from: _container, forKeyIfPresent: .timingDuration) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingDuration, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .duration(timingDuration) + } + if let timingRange = try Range(from: _container, forKeyIfPresent: .timingRange) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingRange, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .range(timingRange) + } + if let timingTiming = try Timing(from: _container, forKeyIfPresent: .timingTiming) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingTiming, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .timing(timingTiming) + } + self.timing = _t_timing + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.transform = try Reference(from: _container, forKeyIfPresent: .transform) + self.triggerDefinition = try [TriggerDefinition](from: _container, forKeyIfPresent: .triggerDefinition) + self.type = try Coding(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action) + try cardinalityBehavior?.encode(on: &_container, forKey: .cardinalityBehavior, auxiliaryKey: ._cardinalityBehavior) + try code?.encode(on: &_container, forKey: .code) + try condition?.encode(on: &_container, forKey: .condition) + try definition?.encode(on: &_container, forKey: .definition) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try documentation?.encode(on: &_container, forKey: .documentation) + try dynamicValue?.encode(on: &_container, forKey: .dynamicValue) + try goalId?.encode(on: &_container, forKey: .goalId, auxiliaryKey: ._goalId) + try groupingBehavior?.encode(on: &_container, forKey: .groupingBehavior, auxiliaryKey: ._groupingBehavior) + try input?.encode(on: &_container, forKey: .input) + try label?.encode(on: &_container, forKey: .label, auxiliaryKey: ._label) + try output?.encode(on: &_container, forKey: .output) + try participant?.encode(on: &_container, forKey: .participant) + try precheckBehavior?.encode(on: &_container, forKey: .precheckBehavior, auxiliaryKey: ._precheckBehavior) + try reason?.encode(on: &_container, forKey: .reason) + try relatedAction?.encode(on: &_container, forKey: .relatedAction) + try requiredBehavior?.encode(on: &_container, forKey: .requiredBehavior, auxiliaryKey: ._requiredBehavior) + try selectionBehavior?.encode(on: &_container, forKey: .selectionBehavior, auxiliaryKey: ._selectionBehavior) + try textEquivalent?.encode(on: &_container, forKey: .textEquivalent, auxiliaryKey: ._textEquivalent) + if let _enum = timing { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .timingDateTime, auxiliaryKey: ._timingDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .timingPeriod) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .timingDuration) + case .range(let _value): + try _value.encode(on: &_container, forKey: .timingRange) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .timingTiming) + } + } + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try transform?.encode(on: &_container, forKey: .transform) + try triggerDefinition?.encode(on: &_container, forKey: .triggerDefinition) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PlanDefinitionAction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && cardinalityBehavior == _other.cardinalityBehavior + && code == _other.code + && condition == _other.condition + && definition == _other.definition + && description_fhir == _other.description_fhir + && documentation == _other.documentation + && dynamicValue == _other.dynamicValue + && goalId == _other.goalId + && groupingBehavior == _other.groupingBehavior + && input == _other.input + && label == _other.label + && output == _other.output + && participant == _other.participant + && precheckBehavior == _other.precheckBehavior + && reason == _other.reason + && relatedAction == _other.relatedAction + && requiredBehavior == _other.requiredBehavior + && selectionBehavior == _other.selectionBehavior + && textEquivalent == _other.textEquivalent + && timing == _other.timing + && title == _other.title + && transform == _other.transform + && triggerDefinition == _other.triggerDefinition + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(cardinalityBehavior) + hasher.combine(code) + hasher.combine(condition) + hasher.combine(definition) + hasher.combine(description_fhir) + hasher.combine(documentation) + hasher.combine(dynamicValue) + hasher.combine(goalId) + hasher.combine(groupingBehavior) + hasher.combine(input) + hasher.combine(label) + hasher.combine(output) + hasher.combine(participant) + hasher.combine(precheckBehavior) + hasher.combine(reason) + hasher.combine(relatedAction) + hasher.combine(requiredBehavior) + hasher.combine(selectionBehavior) + hasher.combine(textEquivalent) + hasher.combine(timing) + hasher.combine(title) + hasher.combine(transform) + hasher.combine(triggerDefinition) + hasher.combine(type) + } +} + +/** + Whether or not the action is applicable. + + An expression that describes applicability criteria, or start/stop conditions for the action. + */ +open class PlanDefinitionActionCondition: BackboneElement { + + /// The kind of condition. + public var kind: FHIRPrimitive + + /// Natural language description of the condition + public var description_fhir: FHIRPrimitive? + + /// Language of the expression + public var language: FHIRPrimitive? + + /// Boolean-valued expression + public var expression: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(kind: FHIRPrimitive) { + self.kind = kind + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + expression: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + kind: FHIRPrimitive, + language: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(kind: kind) + self.description_fhir = description_fhir + self.expression = expression + self.`extension` = `extension` + self.id = id + self.language = language + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case expression; case _expression + case kind; case _kind + case language; case _language + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.expression = try FHIRPrimitive(from: _container, forKeyIfPresent: .expression, auxiliaryKey: ._expression) + self.kind = try FHIRPrimitive(from: _container, forKey: .kind, auxiliaryKey: ._kind) + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try expression?.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try kind.encode(on: &_container, forKey: .kind, auxiliaryKey: ._kind) + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PlanDefinitionActionCondition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && expression == _other.expression + && kind == _other.kind + && language == _other.language + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(expression) + hasher.combine(kind) + hasher.combine(language) + } +} + +/** + Dynamic aspects of the definition. + + Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication + must be computed based on the patient's weight, a customization would be used to specify an expression that calculated + the weight, and the path on the resource that would contain the result. + */ +open class PlanDefinitionActionDynamicValue: BackboneElement { + + /// Natural language description of the dynamic value + public var description_fhir: FHIRPrimitive? + + /// The path to the element to be set dynamically + public var path: FHIRPrimitive? + + /// Language of the expression + public var language: FHIRPrimitive? + + /// An expression that provides the dynamic value for the customization + public var expression: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + expression: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + path: FHIRPrimitive? = nil) + { + self.init() + self.description_fhir = description_fhir + self.expression = expression + self.`extension` = `extension` + self.id = id + self.language = language + self.modifierExtension = modifierExtension + self.path = path + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case expression; case _expression + case language; case _language + case path; case _path + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.expression = try FHIRPrimitive(from: _container, forKeyIfPresent: .expression, auxiliaryKey: ._expression) + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + self.path = try FHIRPrimitive(from: _container, forKeyIfPresent: .path, auxiliaryKey: ._path) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try expression?.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try path?.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PlanDefinitionActionDynamicValue else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && expression == _other.expression + && language == _other.language + && path == _other.path + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(expression) + hasher.combine(language) + hasher.combine(path) + } +} + +/** + Who should participate in the action. + + Indicates who should participate in performing the action described. + */ +open class PlanDefinitionActionParticipant: BackboneElement { + + /// The type of participant in the action. + public var type: FHIRPrimitive + + /// E.g. Nurse, Surgeon, Parent, etc + public var role: CodeableConcept? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + role: CodeableConcept? = nil, + type: FHIRPrimitive) + { + self.init(type: type) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case role + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try role?.encode(on: &_container, forKey: .role) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PlanDefinitionActionParticipant else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return role == _other.role + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(role) + hasher.combine(type) + } +} + +/** + Relationship to another action. + + A relationship to another action such as "before" or "30-60 minutes after start of". + */ +open class PlanDefinitionActionRelatedAction: BackboneElement { + + /// All possible types for "offset[x]" + public enum OffsetX: Hashable { + case duration(Duration) + case range(Range) + } + + /// What action is this related to + public var actionId: FHIRPrimitive + + /// The relationship of this action to the related action. + public var relationship: FHIRPrimitive + + /// Time offset for the relationship + /// One of `offset[x]` + public var offset: OffsetX? + + /// Designated initializer taking all required properties + public init(actionId: FHIRPrimitive, relationship: FHIRPrimitive) { + self.actionId = actionId + self.relationship = relationship + super.init() + } + + /// Convenience initializer + public convenience init( + actionId: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + offset: OffsetX? = nil, + relationship: FHIRPrimitive) + { + self.init(actionId: actionId, relationship: relationship) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.offset = offset + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actionId; case _actionId + case offsetDuration + case offsetRange + case relationship; case _relationship + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actionId = try FHIRPrimitive(from: _container, forKey: .actionId, auxiliaryKey: ._actionId) + var _t_offset: OffsetX? = nil + if let offsetDuration = try Duration(from: _container, forKeyIfPresent: .offsetDuration) { + if _t_offset != nil { + throw DecodingError.dataCorruptedError(forKey: .offsetDuration, in: _container, debugDescription: "More than one value provided for \"offset\"") + } + _t_offset = .duration(offsetDuration) + } + if let offsetRange = try Range(from: _container, forKeyIfPresent: .offsetRange) { + if _t_offset != nil { + throw DecodingError.dataCorruptedError(forKey: .offsetRange, in: _container, debugDescription: "More than one value provided for \"offset\"") + } + _t_offset = .range(offsetRange) + } + self.offset = _t_offset + self.relationship = try FHIRPrimitive(from: _container, forKey: .relationship, auxiliaryKey: ._relationship) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actionId.encode(on: &_container, forKey: .actionId, auxiliaryKey: ._actionId) + if let _enum = offset { + switch _enum { + case .duration(let _value): + try _value.encode(on: &_container, forKey: .offsetDuration) + case .range(let _value): + try _value.encode(on: &_container, forKey: .offsetRange) + } + } + try relationship.encode(on: &_container, forKey: .relationship, auxiliaryKey: ._relationship) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PlanDefinitionActionRelatedAction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actionId == _other.actionId + && offset == _other.offset + && relationship == _other.relationship + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actionId) + hasher.combine(offset) + hasher.combine(relationship) + } +} + +/** + What the plan is trying to accomplish. + + Goals that describe what the activities within the plan are intended to achieve. For example, weight loss, restoring an + activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc. + */ +open class PlanDefinitionGoal: BackboneElement { + + /// E.g. Treatment, dietary, behavioral, etc + public var category: CodeableConcept? + + /// Code or text describing the goal + public var description_fhir: CodeableConcept + + /// high-priority | medium-priority | low-priority + public var priority: CodeableConcept? + + /// When goal pursuit begins + public var start: CodeableConcept? + + /// What does the goal address + public var addresses: [CodeableConcept]? + + /// Supporting documentation for the goal + public var documentation: [RelatedArtifact]? + + /// Target outcome for the goal + public var target: [PlanDefinitionGoalTarget]? + + /// Designated initializer taking all required properties + public init(description_fhir: CodeableConcept) { + self.description_fhir = description_fhir + super.init() + } + + /// Convenience initializer + public convenience init( + addresses: [CodeableConcept]? = nil, + category: CodeableConcept? = nil, + description_fhir: CodeableConcept, + documentation: [RelatedArtifact]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + priority: CodeableConcept? = nil, + start: CodeableConcept? = nil, + target: [PlanDefinitionGoalTarget]? = nil) + { + self.init(description_fhir: description_fhir) + self.addresses = addresses + self.category = category + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.priority = priority + self.start = start + self.target = target + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case addresses + case category + case description_fhir = "description" + case documentation + case priority + case start + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.addresses = try [CodeableConcept](from: _container, forKeyIfPresent: .addresses) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.description_fhir = try CodeableConcept(from: _container, forKey: .description_fhir) + self.documentation = try [RelatedArtifact](from: _container, forKeyIfPresent: .documentation) + self.priority = try CodeableConcept(from: _container, forKeyIfPresent: .priority) + self.start = try CodeableConcept(from: _container, forKeyIfPresent: .start) + self.target = try [PlanDefinitionGoalTarget](from: _container, forKeyIfPresent: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try addresses?.encode(on: &_container, forKey: .addresses) + try category?.encode(on: &_container, forKey: .category) + try description_fhir.encode(on: &_container, forKey: .description_fhir) + try documentation?.encode(on: &_container, forKey: .documentation) + try priority?.encode(on: &_container, forKey: .priority) + try start?.encode(on: &_container, forKey: .start) + try target?.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PlanDefinitionGoal else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return addresses == _other.addresses + && category == _other.category + && description_fhir == _other.description_fhir + && documentation == _other.documentation + && priority == _other.priority + && start == _other.start + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(addresses) + hasher.combine(category) + hasher.combine(description_fhir) + hasher.combine(documentation) + hasher.combine(priority) + hasher.combine(start) + hasher.combine(target) + } +} + +/** + Target outcome for the goal. + + Indicates what should be done and within what timeframe. + */ +open class PlanDefinitionGoalTarget: BackboneElement { + + /// All possible types for "detail[x]" + public enum DetailX: Hashable { + case codeableConcept(CodeableConcept) + case quantity(Quantity) + case range(Range) + } + + /// The parameter whose value is to be tracked + public var measure: CodeableConcept? + + /// The target value to be achieved + /// One of `detail[x]` + public var detail: DetailX? + + /// Reach goal within + public var due: Duration? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + detail: DetailX? = nil, + due: Duration? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + measure: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.detail = detail + self.due = due + self.`extension` = `extension` + self.id = id + self.measure = measure + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case detailCodeableConcept + case detailQuantity + case detailRange + case due + case measure + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_detail: DetailX? = nil + if let detailQuantity = try Quantity(from: _container, forKeyIfPresent: .detailQuantity) { + if _t_detail != nil { + throw DecodingError.dataCorruptedError(forKey: .detailQuantity, in: _container, debugDescription: "More than one value provided for \"detail\"") + } + _t_detail = .quantity(detailQuantity) + } + if let detailRange = try Range(from: _container, forKeyIfPresent: .detailRange) { + if _t_detail != nil { + throw DecodingError.dataCorruptedError(forKey: .detailRange, in: _container, debugDescription: "More than one value provided for \"detail\"") + } + _t_detail = .range(detailRange) + } + if let detailCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .detailCodeableConcept) { + if _t_detail != nil { + throw DecodingError.dataCorruptedError(forKey: .detailCodeableConcept, in: _container, debugDescription: "More than one value provided for \"detail\"") + } + _t_detail = .codeableConcept(detailCodeableConcept) + } + self.detail = _t_detail + self.due = try Duration(from: _container, forKeyIfPresent: .due) + self.measure = try CodeableConcept(from: _container, forKeyIfPresent: .measure) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = detail { + switch _enum { + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .detailQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .detailRange) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .detailCodeableConcept) + } + } + try due?.encode(on: &_container, forKey: .due) + try measure?.encode(on: &_container, forKey: .measure) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PlanDefinitionGoalTarget else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return detail == _other.detail + && due == _other.due + && measure == _other.measure + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(detail) + hasher.combine(due) + hasher.combine(measure) + } +} diff --git a/Sources/ModelsSTU3/Practitioner.swift b/Sources/ModelsSTU3/Practitioner.swift new file mode 100644 index 0000000..2dfc88b --- /dev/null +++ b/Sources/ModelsSTU3/Practitioner.swift @@ -0,0 +1,293 @@ +// +// Practitioner.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Practitioner) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A person with a formal responsibility in the provisioning of healthcare or related services. + + A person who is directly or indirectly involved in the provisioning of healthcare. + */ +open class Practitioner: DomainResource { + + override open class var resourceType: ResourceType { return .practitioner } + + /// A identifier for the person as this agent + public var identifier: [Identifier]? + + /// Whether this practitioner's record is in active use + public var active: FHIRPrimitive? + + /// The name(s) associated with the practitioner + public var name: [HumanName]? + + /// A contact detail for the practitioner (that apply to all roles) + public var telecom: [ContactPoint]? + + /// Address(es) of the practitioner that are not role specific (typically home address) + public var address: [Address]? + + /// Administrative Gender - the gender that the person is considered to have for administration and record keeping + /// purposes. + public var gender: FHIRPrimitive? + + /// The date on which the practitioner was born + public var birthDate: FHIRPrimitive? + + /// Image of the person + public var photo: [Attachment]? + + /// Qualifications obtained by training and certification + public var qualification: [PractitionerQualification]? + + /// A language the practitioner is able to use in patient communication + public var communication: [CodeableConcept]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + address: [Address]? = nil, + birthDate: FHIRPrimitive? = nil, + communication: [CodeableConcept]? = nil, + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + gender: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: [HumanName]? = nil, + photo: [Attachment]? = nil, + qualification: [PractitionerQualification]? = nil, + telecom: [ContactPoint]? = nil, + text: Narrative? = nil) + { + self.init() + self.active = active + self.address = address + self.birthDate = birthDate + self.communication = communication + self.contained = contained + self.`extension` = `extension` + self.gender = gender + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.photo = photo + self.qualification = qualification + self.telecom = telecom + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case address + case birthDate; case _birthDate + case communication + case gender; case _gender + case identifier + case name + case photo + case qualification + case telecom + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.address = try [Address](from: _container, forKeyIfPresent: .address) + self.birthDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .birthDate, auxiliaryKey: ._birthDate) + self.communication = try [CodeableConcept](from: _container, forKeyIfPresent: .communication) + self.gender = try FHIRPrimitive(from: _container, forKeyIfPresent: .gender, auxiliaryKey: ._gender) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.name = try [HumanName](from: _container, forKeyIfPresent: .name) + self.photo = try [Attachment](from: _container, forKeyIfPresent: .photo) + self.qualification = try [PractitionerQualification](from: _container, forKeyIfPresent: .qualification) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try address?.encode(on: &_container, forKey: .address) + try birthDate?.encode(on: &_container, forKey: .birthDate, auxiliaryKey: ._birthDate) + try communication?.encode(on: &_container, forKey: .communication) + try gender?.encode(on: &_container, forKey: .gender, auxiliaryKey: ._gender) + try identifier?.encode(on: &_container, forKey: .identifier) + try name?.encode(on: &_container, forKey: .name) + try photo?.encode(on: &_container, forKey: .photo) + try qualification?.encode(on: &_container, forKey: .qualification) + try telecom?.encode(on: &_container, forKey: .telecom) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Practitioner else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && address == _other.address + && birthDate == _other.birthDate + && communication == _other.communication + && gender == _other.gender + && identifier == _other.identifier + && name == _other.name + && photo == _other.photo + && qualification == _other.qualification + && telecom == _other.telecom + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(address) + hasher.combine(birthDate) + hasher.combine(communication) + hasher.combine(gender) + hasher.combine(identifier) + hasher.combine(name) + hasher.combine(photo) + hasher.combine(qualification) + hasher.combine(telecom) + } +} + +/** + Qualifications obtained by training and certification. + */ +open class PractitionerQualification: BackboneElement { + + /// An identifier for this qualification for the practitioner + public var identifier: [Identifier]? + + /// Coded representation of the qualification + public var code: CodeableConcept + + /// Period during which the qualification is valid + public var period: Period? + + /// Organization that regulates and issues the qualification + public var issuer: Reference? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + issuer: Reference? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil) + { + self.init(code: code) + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.issuer = issuer + self.modifierExtension = modifierExtension + self.period = period + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case identifier + case issuer + case period + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKey: .code) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.issuer = try Reference(from: _container, forKeyIfPresent: .issuer) + self.period = try Period(from: _container, forKeyIfPresent: .period) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code) + try identifier?.encode(on: &_container, forKey: .identifier) + try issuer?.encode(on: &_container, forKey: .issuer) + try period?.encode(on: &_container, forKey: .period) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PractitionerQualification else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && identifier == _other.identifier + && issuer == _other.issuer + && period == _other.period + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(identifier) + hasher.combine(issuer) + hasher.combine(period) + } +} diff --git a/Sources/ModelsSTU3/PractitionerRole.swift b/Sources/ModelsSTU3/PractitionerRole.swift new file mode 100644 index 0000000..cb3c05f --- /dev/null +++ b/Sources/ModelsSTU3/PractitionerRole.swift @@ -0,0 +1,416 @@ +// +// PractitionerRole.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/PractitionerRole) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Roles/organizations the practitioner is associated with. + + A specific set of Roles/Locations/specialties/services that a practitioner may perform at an organization for a period + of time. + */ +open class PractitionerRole: DomainResource { + + override open class var resourceType: ResourceType { return .practitionerRole } + + /// Business Identifiers that are specific to a role/location + public var identifier: [Identifier]? + + /// Whether this practitioner's record is in active use + public var active: FHIRPrimitive? + + /// The period during which the practitioner is authorized to perform in these role(s) + public var period: Period? + + /// Practitioner that is able to provide the defined services for the organation + public var practitioner: Reference? + + /// Organization where the roles are available + public var organization: Reference? + + /// Roles which this practitioner may perform + public var code: [CodeableConcept]? + + /// Specific specialty of the practitioner + public var specialty: [CodeableConcept]? + + /// The location(s) at which this practitioner provides care + public var location: [Reference]? + + /// The list of healthcare services that this worker provides for this role's Organization/Location(s) + public var healthcareService: [Reference]? + + /// Contact details that are specific to the role/location/service + public var telecom: [ContactPoint]? + + /// Times the Service Site is available + public var availableTime: [PractitionerRoleAvailableTime]? + + /// Not available during this time due to provided reason + public var notAvailable: [PractitionerRoleNotAvailable]? + + /// Description of availability exceptions + public var availabilityExceptions: FHIRPrimitive? + + /// Technical endpoints providing access to services operated for the practitioner with this role + public var endpoint: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + availabilityExceptions: FHIRPrimitive? = nil, + availableTime: [PractitionerRoleAvailableTime]? = nil, + code: [CodeableConcept]? = nil, + contained: [ResourceProxy]? = nil, + endpoint: [Reference]? = nil, + `extension`: [Extension]? = nil, + healthcareService: [Reference]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + location: [Reference]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + notAvailable: [PractitionerRoleNotAvailable]? = nil, + organization: Reference? = nil, + period: Period? = nil, + practitioner: Reference? = nil, + specialty: [CodeableConcept]? = nil, + telecom: [ContactPoint]? = nil, + text: Narrative? = nil) + { + self.init() + self.active = active + self.availabilityExceptions = availabilityExceptions + self.availableTime = availableTime + self.code = code + self.contained = contained + self.endpoint = endpoint + self.`extension` = `extension` + self.healthcareService = healthcareService + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.location = location + self.meta = meta + self.modifierExtension = modifierExtension + self.notAvailable = notAvailable + self.organization = organization + self.period = period + self.practitioner = practitioner + self.specialty = specialty + self.telecom = telecom + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case availabilityExceptions; case _availabilityExceptions + case availableTime + case code + case endpoint + case healthcareService + case identifier + case location + case notAvailable + case organization + case period + case practitioner + case specialty + case telecom + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.availabilityExceptions = try FHIRPrimitive(from: _container, forKeyIfPresent: .availabilityExceptions, auxiliaryKey: ._availabilityExceptions) + self.availableTime = try [PractitionerRoleAvailableTime](from: _container, forKeyIfPresent: .availableTime) + self.code = try [CodeableConcept](from: _container, forKeyIfPresent: .code) + self.endpoint = try [Reference](from: _container, forKeyIfPresent: .endpoint) + self.healthcareService = try [Reference](from: _container, forKeyIfPresent: .healthcareService) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.location = try [Reference](from: _container, forKeyIfPresent: .location) + self.notAvailable = try [PractitionerRoleNotAvailable](from: _container, forKeyIfPresent: .notAvailable) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.practitioner = try Reference(from: _container, forKeyIfPresent: .practitioner) + self.specialty = try [CodeableConcept](from: _container, forKeyIfPresent: .specialty) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try availabilityExceptions?.encode(on: &_container, forKey: .availabilityExceptions, auxiliaryKey: ._availabilityExceptions) + try availableTime?.encode(on: &_container, forKey: .availableTime) + try code?.encode(on: &_container, forKey: .code) + try endpoint?.encode(on: &_container, forKey: .endpoint) + try healthcareService?.encode(on: &_container, forKey: .healthcareService) + try identifier?.encode(on: &_container, forKey: .identifier) + try location?.encode(on: &_container, forKey: .location) + try notAvailable?.encode(on: &_container, forKey: .notAvailable) + try organization?.encode(on: &_container, forKey: .organization) + try period?.encode(on: &_container, forKey: .period) + try practitioner?.encode(on: &_container, forKey: .practitioner) + try specialty?.encode(on: &_container, forKey: .specialty) + try telecom?.encode(on: &_container, forKey: .telecom) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PractitionerRole else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && availabilityExceptions == _other.availabilityExceptions + && availableTime == _other.availableTime + && code == _other.code + && endpoint == _other.endpoint + && healthcareService == _other.healthcareService + && identifier == _other.identifier + && location == _other.location + && notAvailable == _other.notAvailable + && organization == _other.organization + && period == _other.period + && practitioner == _other.practitioner + && specialty == _other.specialty + && telecom == _other.telecom + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(availabilityExceptions) + hasher.combine(availableTime) + hasher.combine(code) + hasher.combine(endpoint) + hasher.combine(healthcareService) + hasher.combine(identifier) + hasher.combine(location) + hasher.combine(notAvailable) + hasher.combine(organization) + hasher.combine(period) + hasher.combine(practitioner) + hasher.combine(specialty) + hasher.combine(telecom) + } +} + +/** + Times the Service Site is available. + + A collection of times that the Service Site is available. + */ +open class PractitionerRoleAvailableTime: BackboneElement { + + /// Indicates which days of the week are available between the start and end Times. + public var daysOfWeek: [FHIRPrimitive]? + + /// Always available? e.g. 24 hour service + public var allDay: FHIRPrimitive? + + /// Opening time of day (ignored if allDay = true) + public var availableStartTime: FHIRPrimitive? + + /// Closing time of day (ignored if allDay = true) + public var availableEndTime: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + allDay: FHIRPrimitive? = nil, + availableEndTime: FHIRPrimitive? = nil, + availableStartTime: FHIRPrimitive? = nil, + daysOfWeek: [FHIRPrimitive]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init() + self.allDay = allDay + self.availableEndTime = availableEndTime + self.availableStartTime = availableStartTime + self.daysOfWeek = daysOfWeek + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case allDay; case _allDay + case availableEndTime; case _availableEndTime + case availableStartTime; case _availableStartTime + case daysOfWeek; case _daysOfWeek + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.allDay = try FHIRPrimitive(from: _container, forKeyIfPresent: .allDay, auxiliaryKey: ._allDay) + self.availableEndTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .availableEndTime, auxiliaryKey: ._availableEndTime) + self.availableStartTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .availableStartTime, auxiliaryKey: ._availableStartTime) + self.daysOfWeek = try [FHIRPrimitive](from: _container, forKeyIfPresent: .daysOfWeek, auxiliaryKey: ._daysOfWeek) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try allDay?.encode(on: &_container, forKey: .allDay, auxiliaryKey: ._allDay) + try availableEndTime?.encode(on: &_container, forKey: .availableEndTime, auxiliaryKey: ._availableEndTime) + try availableStartTime?.encode(on: &_container, forKey: .availableStartTime, auxiliaryKey: ._availableStartTime) + try daysOfWeek?.encode(on: &_container, forKey: .daysOfWeek, auxiliaryKey: ._daysOfWeek) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PractitionerRoleAvailableTime else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return allDay == _other.allDay + && availableEndTime == _other.availableEndTime + && availableStartTime == _other.availableStartTime + && daysOfWeek == _other.daysOfWeek + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(allDay) + hasher.combine(availableEndTime) + hasher.combine(availableStartTime) + hasher.combine(daysOfWeek) + } +} + +/** + Not available during this time due to provided reason. + + The HealthcareService is not available during this period of time due to the provided reason. + */ +open class PractitionerRoleNotAvailable: BackboneElement { + + /// Reason presented to the user explaining why time not available + public var description_fhir: FHIRPrimitive + + /// Service not availablefrom this date + public var during: Period? + + /// Designated initializer taking all required properties + public init(description_fhir: FHIRPrimitive) { + self.description_fhir = description_fhir + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive, + during: Period? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(description_fhir: description_fhir) + self.during = during + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case during + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + self.during = try Period(from: _container, forKeyIfPresent: .during) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try during?.encode(on: &_container, forKey: .during) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? PractitionerRoleNotAvailable else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && during == _other.during + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(during) + } +} diff --git a/Sources/ModelsSTU3/Procedure.swift b/Sources/ModelsSTU3/Procedure.swift new file mode 100644 index 0000000..6985837 --- /dev/null +++ b/Sources/ModelsSTU3/Procedure.swift @@ -0,0 +1,555 @@ +// +// Procedure.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Procedure) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + An action that is being or was performed on a patient. + + An action that is or was performed on a patient. This can be a physical intervention like an operation, or less + invasive like counseling or hypnotherapy. + */ +open class Procedure: DomainResource { + + override open class var resourceType: ResourceType { return .procedure } + + /// All possible types for "performed[x]" + public enum PerformedX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// External Identifiers for this procedure + public var identifier: [Identifier]? + + /// Instantiates protocol or definition + public var definition: [Reference]? + + /// A request for this procedure + public var basedOn: [Reference]? + + /// Part of referenced event + public var partOf: [Reference]? + + /// A code specifying the state of the procedure. Generally this will be in-progress or completed state. + public var status: FHIRPrimitive + + /// True if procedure was not performed as scheduled + public var notDone: FHIRPrimitive? + + /// Reason procedure was not performed + public var notDoneReason: CodeableConcept? + + /// Classification of the procedure + public var category: CodeableConcept? + + /// Identification of the procedure + public var code: CodeableConcept? + + /// Who the procedure was performed on + public var subject: Reference + + /// Encounter or episode associated with the procedure + public var context: Reference? + + /// Date/Period the procedure was performed + /// One of `performed[x]` + public var performed: PerformedX? + + /// The people who performed the procedure + public var performer: [ProcedurePerformer]? + + /// Where the procedure happened + public var location: Reference? + + /// Coded reason procedure performed + public var reasonCode: [CodeableConcept]? + + /// Condition that is the reason the procedure performed + public var reasonReference: [Reference]? + + /// Target body sites + public var bodySite: [CodeableConcept]? + + /// The result of procedure + public var outcome: CodeableConcept? + + /// Any report resulting from the procedure + public var report: [Reference]? + + /// Complication following the procedure + public var complication: [CodeableConcept]? + + /// A condition that is a result of the procedure + public var complicationDetail: [Reference]? + + /// Instructions for follow up + public var followUp: [CodeableConcept]? + + /// Additional information about the procedure + public var note: [Annotation]? + + /// Device changed in procedure + public var focalDevice: [ProcedureFocalDevice]? + + /// Items used during procedure + public var usedReference: [Reference]? + + /// Coded items used during the procedure + public var usedCode: [CodeableConcept]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive, subject: Reference) { + self.status = status + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + basedOn: [Reference]? = nil, + bodySite: [CodeableConcept]? = nil, + category: CodeableConcept? = nil, + code: CodeableConcept? = nil, + complication: [CodeableConcept]? = nil, + complicationDetail: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: [Reference]? = nil, + `extension`: [Extension]? = nil, + focalDevice: [ProcedureFocalDevice]? = nil, + followUp: [CodeableConcept]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + location: Reference? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + notDone: FHIRPrimitive? = nil, + notDoneReason: CodeableConcept? = nil, + note: [Annotation]? = nil, + outcome: CodeableConcept? = nil, + partOf: [Reference]? = nil, + performed: PerformedX? = nil, + performer: [ProcedurePerformer]? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + report: [Reference]? = nil, + status: FHIRPrimitive, + subject: Reference, + text: Narrative? = nil, + usedCode: [CodeableConcept]? = nil, + usedReference: [Reference]? = nil) + { + self.init(status: status, subject: subject) + self.basedOn = basedOn + self.bodySite = bodySite + self.category = category + self.code = code + self.complication = complication + self.complicationDetail = complicationDetail + self.contained = contained + self.context = context + self.definition = definition + self.`extension` = `extension` + self.focalDevice = focalDevice + self.followUp = followUp + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.location = location + self.meta = meta + self.modifierExtension = modifierExtension + self.notDone = notDone + self.notDoneReason = notDoneReason + self.note = note + self.outcome = outcome + self.partOf = partOf + self.performed = performed + self.performer = performer + self.reasonCode = reasonCode + self.reasonReference = reasonReference + self.report = report + self.text = text + self.usedCode = usedCode + self.usedReference = usedReference + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case basedOn + case bodySite + case category + case code + case complication + case complicationDetail + case context + case definition + case focalDevice + case followUp + case identifier + case location + case notDone; case _notDone + case notDoneReason + case note + case outcome + case partOf + case performedDateTime; case _performedDateTime + case performedPeriod + case performer + case reasonCode + case reasonReference + case report + case status; case _status + case subject + case usedCode + case usedReference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.bodySite = try [CodeableConcept](from: _container, forKeyIfPresent: .bodySite) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.complication = try [CodeableConcept](from: _container, forKeyIfPresent: .complication) + self.complicationDetail = try [Reference](from: _container, forKeyIfPresent: .complicationDetail) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.definition = try [Reference](from: _container, forKeyIfPresent: .definition) + self.focalDevice = try [ProcedureFocalDevice](from: _container, forKeyIfPresent: .focalDevice) + self.followUp = try [CodeableConcept](from: _container, forKeyIfPresent: .followUp) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.location = try Reference(from: _container, forKeyIfPresent: .location) + self.notDone = try FHIRPrimitive(from: _container, forKeyIfPresent: .notDone, auxiliaryKey: ._notDone) + self.notDoneReason = try CodeableConcept(from: _container, forKeyIfPresent: .notDoneReason) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.outcome = try CodeableConcept(from: _container, forKeyIfPresent: .outcome) + self.partOf = try [Reference](from: _container, forKeyIfPresent: .partOf) + var _t_performed: PerformedX? = nil + if let performedDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .performedDateTime, auxiliaryKey: ._performedDateTime) { + if _t_performed != nil { + throw DecodingError.dataCorruptedError(forKey: .performedDateTime, in: _container, debugDescription: "More than one value provided for \"performed\"") + } + _t_performed = .dateTime(performedDateTime) + } + if let performedPeriod = try Period(from: _container, forKeyIfPresent: .performedPeriod) { + if _t_performed != nil { + throw DecodingError.dataCorruptedError(forKey: .performedPeriod, in: _container, debugDescription: "More than one value provided for \"performed\"") + } + _t_performed = .period(performedPeriod) + } + self.performed = _t_performed + self.performer = try [ProcedurePerformer](from: _container, forKeyIfPresent: .performer) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.report = try [Reference](from: _container, forKeyIfPresent: .report) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.usedCode = try [CodeableConcept](from: _container, forKeyIfPresent: .usedCode) + self.usedReference = try [Reference](from: _container, forKeyIfPresent: .usedReference) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try basedOn?.encode(on: &_container, forKey: .basedOn) + try bodySite?.encode(on: &_container, forKey: .bodySite) + try category?.encode(on: &_container, forKey: .category) + try code?.encode(on: &_container, forKey: .code) + try complication?.encode(on: &_container, forKey: .complication) + try complicationDetail?.encode(on: &_container, forKey: .complicationDetail) + try context?.encode(on: &_container, forKey: .context) + try definition?.encode(on: &_container, forKey: .definition) + try focalDevice?.encode(on: &_container, forKey: .focalDevice) + try followUp?.encode(on: &_container, forKey: .followUp) + try identifier?.encode(on: &_container, forKey: .identifier) + try location?.encode(on: &_container, forKey: .location) + try notDone?.encode(on: &_container, forKey: .notDone, auxiliaryKey: ._notDone) + try notDoneReason?.encode(on: &_container, forKey: .notDoneReason) + try note?.encode(on: &_container, forKey: .note) + try outcome?.encode(on: &_container, forKey: .outcome) + try partOf?.encode(on: &_container, forKey: .partOf) + if let _enum = performed { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .performedDateTime, auxiliaryKey: ._performedDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .performedPeriod) + } + } + try performer?.encode(on: &_container, forKey: .performer) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try report?.encode(on: &_container, forKey: .report) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try usedCode?.encode(on: &_container, forKey: .usedCode) + try usedReference?.encode(on: &_container, forKey: .usedReference) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Procedure else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return basedOn == _other.basedOn + && bodySite == _other.bodySite + && category == _other.category + && code == _other.code + && complication == _other.complication + && complicationDetail == _other.complicationDetail + && context == _other.context + && definition == _other.definition + && focalDevice == _other.focalDevice + && followUp == _other.followUp + && identifier == _other.identifier + && location == _other.location + && notDone == _other.notDone + && notDoneReason == _other.notDoneReason + && note == _other.note + && outcome == _other.outcome + && partOf == _other.partOf + && performed == _other.performed + && performer == _other.performer + && reasonCode == _other.reasonCode + && reasonReference == _other.reasonReference + && report == _other.report + && status == _other.status + && subject == _other.subject + && usedCode == _other.usedCode + && usedReference == _other.usedReference + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(basedOn) + hasher.combine(bodySite) + hasher.combine(category) + hasher.combine(code) + hasher.combine(complication) + hasher.combine(complicationDetail) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(focalDevice) + hasher.combine(followUp) + hasher.combine(identifier) + hasher.combine(location) + hasher.combine(notDone) + hasher.combine(notDoneReason) + hasher.combine(note) + hasher.combine(outcome) + hasher.combine(partOf) + hasher.combine(performed) + hasher.combine(performer) + hasher.combine(reasonCode) + hasher.combine(reasonReference) + hasher.combine(report) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(usedCode) + hasher.combine(usedReference) + } +} + +/** + Device changed in procedure. + + A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, + attaching a wound-vac, etc.) as a focal portion of the Procedure. + */ +open class ProcedureFocalDevice: BackboneElement { + + /// Kind of change to device + public var action: CodeableConcept? + + /// Device that was changed + public var manipulated: Reference + + /// Designated initializer taking all required properties + public init(manipulated: Reference) { + self.manipulated = manipulated + super.init() + } + + /// Convenience initializer + public convenience init( + action: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + manipulated: Reference, + modifierExtension: [Extension]? = nil) + { + self.init(manipulated: manipulated) + self.action = action + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case manipulated + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try CodeableConcept(from: _container, forKeyIfPresent: .action) + self.manipulated = try Reference(from: _container, forKey: .manipulated) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action) + try manipulated.encode(on: &_container, forKey: .manipulated) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ProcedureFocalDevice else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && manipulated == _other.manipulated + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(manipulated) + } +} + +/** + The people who performed the procedure. + + Limited to 'real' people rather than equipment. + */ +open class ProcedurePerformer: BackboneElement { + + /// The role the actor was in + public var role: CodeableConcept? + + /// The reference to the practitioner + public var actor: Reference + + /// Organization the device or practitioner was acting for + public var onBehalfOf: Reference? + + /// Designated initializer taking all required properties + public init(actor: Reference) { + self.actor = actor + super.init() + } + + /// Convenience initializer + public convenience init( + actor: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil, + role: CodeableConcept? = nil) + { + self.init(actor: actor) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actor + case onBehalfOf + case role + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actor = try Reference(from: _container, forKey: .actor) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + self.role = try CodeableConcept(from: _container, forKeyIfPresent: .role) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actor.encode(on: &_container, forKey: .actor) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try role?.encode(on: &_container, forKey: .role) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ProcedurePerformer else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actor == _other.actor + && onBehalfOf == _other.onBehalfOf + && role == _other.role + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actor) + hasher.combine(onBehalfOf) + hasher.combine(role) + } +} diff --git a/Sources/ModelsSTU3/ProcedureRequest.swift b/Sources/ModelsSTU3/ProcedureRequest.swift new file mode 100644 index 0000000..14ebaca --- /dev/null +++ b/Sources/ModelsSTU3/ProcedureRequest.swift @@ -0,0 +1,500 @@ +// +// ProcedureRequest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ProcedureRequest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A request for a procedure or diagnostic to be performed. + + A record of a request for diagnostic investigations, treatments, or operations to be performed. + */ +open class ProcedureRequest: DomainResource { + + override open class var resourceType: ResourceType { return .procedureRequest } + + /// All possible types for "asNeeded[x]" + public enum AsNeededX: Hashable { + case boolean(FHIRPrimitive) + case codeableConcept(CodeableConcept) + } + + /// All possible types for "occurrence[x]" + public enum OccurrenceX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + case timing(Timing) + } + + /// Identifiers assigned to this order + public var identifier: [Identifier]? + + /// Protocol or definition + public var definition: [Reference]? + + /// What request fulfills + public var basedOn: [Reference]? + + /// What request replaces + public var replaces: [Reference]? + + /// Composite Request ID + public var requisition: Identifier? + + /// The status of the order. + public var status: FHIRPrimitive + + /// Whether the request is a proposal, plan, an original order or a reflex order. + public var intent: FHIRPrimitive + + /// Indicates how quickly the ProcedureRequest should be addressed with respect to other requests. + public var priority: FHIRPrimitive? + + /// True if procedure should not be performed + public var doNotPerform: FHIRPrimitive? + + /// Classification of procedure + public var category: [CodeableConcept]? + + /// What is being requested/ordered + public var code: CodeableConcept + + /// Individual the service is ordered for + public var subject: Reference + + /// Encounter or Episode during which request was created + public var context: Reference? + + /// When procedure should occur + /// One of `occurrence[x]` + public var occurrence: OccurrenceX? + + /// Preconditions for procedure or diagnostic + /// One of `asNeeded[x]` + public var asNeeded: AsNeededX? + + /// Date request signed + public var authoredOn: FHIRPrimitive? + + /// Who/what is requesting procedure or diagnostic + public var requester: ProcedureRequestRequester? + + /// Performer role + public var performerType: CodeableConcept? + + /// Requested perfomer + public var performer: Reference? + + /// Explanation/Justification for test + public var reasonCode: [CodeableConcept]? + + /// Explanation/Justification for test + public var reasonReference: [Reference]? + + /// Additional clinical information + public var supportingInfo: [Reference]? + + /// Procedure Samples + public var specimen: [Reference]? + + /// Location on Body + public var bodySite: [CodeableConcept]? + + /// Comments + public var note: [Annotation]? + + /// Request provenance + public var relevantHistory: [Reference]? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept, intent: FHIRPrimitive, status: FHIRPrimitive, subject: Reference) { + self.code = code + self.intent = intent + self.status = status + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + asNeeded: AsNeededX? = nil, + authoredOn: FHIRPrimitive? = nil, + basedOn: [Reference]? = nil, + bodySite: [CodeableConcept]? = nil, + category: [CodeableConcept]? = nil, + code: CodeableConcept, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: [Reference]? = nil, + doNotPerform: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + intent: FHIRPrimitive, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + occurrence: OccurrenceX? = nil, + performer: Reference? = nil, + performerType: CodeableConcept? = nil, + priority: FHIRPrimitive? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + relevantHistory: [Reference]? = nil, + replaces: [Reference]? = nil, + requester: ProcedureRequestRequester? = nil, + requisition: Identifier? = nil, + specimen: [Reference]? = nil, + status: FHIRPrimitive, + subject: Reference, + supportingInfo: [Reference]? = nil, + text: Narrative? = nil) + { + self.init(code: code, intent: intent, status: status, subject: subject) + self.asNeeded = asNeeded + self.authoredOn = authoredOn + self.basedOn = basedOn + self.bodySite = bodySite + self.category = category + self.contained = contained + self.context = context + self.definition = definition + self.doNotPerform = doNotPerform + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.occurrence = occurrence + self.performer = performer + self.performerType = performerType + self.priority = priority + self.reasonCode = reasonCode + self.reasonReference = reasonReference + self.relevantHistory = relevantHistory + self.replaces = replaces + self.requester = requester + self.requisition = requisition + self.specimen = specimen + self.supportingInfo = supportingInfo + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case asNeededBoolean; case _asNeededBoolean + case asNeededCodeableConcept + case authoredOn; case _authoredOn + case basedOn + case bodySite + case category + case code + case context + case definition + case doNotPerform; case _doNotPerform + case identifier + case intent; case _intent + case note + case occurrenceDateTime; case _occurrenceDateTime + case occurrencePeriod + case occurrenceTiming + case performer + case performerType + case priority; case _priority + case reasonCode + case reasonReference + case relevantHistory + case replaces + case requester + case requisition + case specimen + case status; case _status + case subject + case supportingInfo + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_asNeeded: AsNeededX? = nil + if let asNeededBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .asNeededBoolean, auxiliaryKey: ._asNeededBoolean) { + if _t_asNeeded != nil { + throw DecodingError.dataCorruptedError(forKey: .asNeededBoolean, in: _container, debugDescription: "More than one value provided for \"asNeeded\"") + } + _t_asNeeded = .boolean(asNeededBoolean) + } + if let asNeededCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .asNeededCodeableConcept) { + if _t_asNeeded != nil { + throw DecodingError.dataCorruptedError(forKey: .asNeededCodeableConcept, in: _container, debugDescription: "More than one value provided for \"asNeeded\"") + } + _t_asNeeded = .codeableConcept(asNeededCodeableConcept) + } + self.asNeeded = _t_asNeeded + self.authoredOn = try FHIRPrimitive(from: _container, forKeyIfPresent: .authoredOn, auxiliaryKey: ._authoredOn) + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.bodySite = try [CodeableConcept](from: _container, forKeyIfPresent: .bodySite) + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.code = try CodeableConcept(from: _container, forKey: .code) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.definition = try [Reference](from: _container, forKeyIfPresent: .definition) + self.doNotPerform = try FHIRPrimitive(from: _container, forKeyIfPresent: .doNotPerform, auxiliaryKey: ._doNotPerform) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.intent = try FHIRPrimitive(from: _container, forKey: .intent, auxiliaryKey: ._intent) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + var _t_occurrence: OccurrenceX? = nil + if let occurrenceDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceDateTime, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .dateTime(occurrenceDateTime) + } + if let occurrencePeriod = try Period(from: _container, forKeyIfPresent: .occurrencePeriod) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrencePeriod, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .period(occurrencePeriod) + } + if let occurrenceTiming = try Timing(from: _container, forKeyIfPresent: .occurrenceTiming) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceTiming, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .timing(occurrenceTiming) + } + self.occurrence = _t_occurrence + self.performer = try Reference(from: _container, forKeyIfPresent: .performer) + self.performerType = try CodeableConcept(from: _container, forKeyIfPresent: .performerType) + self.priority = try FHIRPrimitive(from: _container, forKeyIfPresent: .priority, auxiliaryKey: ._priority) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.relevantHistory = try [Reference](from: _container, forKeyIfPresent: .relevantHistory) + self.replaces = try [Reference](from: _container, forKeyIfPresent: .replaces) + self.requester = try ProcedureRequestRequester(from: _container, forKeyIfPresent: .requester) + self.requisition = try Identifier(from: _container, forKeyIfPresent: .requisition) + self.specimen = try [Reference](from: _container, forKeyIfPresent: .specimen) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.supportingInfo = try [Reference](from: _container, forKeyIfPresent: .supportingInfo) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = asNeeded { + switch _enum { + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .asNeededBoolean, auxiliaryKey: ._asNeededBoolean) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .asNeededCodeableConcept) + } + } + try authoredOn?.encode(on: &_container, forKey: .authoredOn, auxiliaryKey: ._authoredOn) + try basedOn?.encode(on: &_container, forKey: .basedOn) + try bodySite?.encode(on: &_container, forKey: .bodySite) + try category?.encode(on: &_container, forKey: .category) + try code.encode(on: &_container, forKey: .code) + try context?.encode(on: &_container, forKey: .context) + try definition?.encode(on: &_container, forKey: .definition) + try doNotPerform?.encode(on: &_container, forKey: .doNotPerform, auxiliaryKey: ._doNotPerform) + try identifier?.encode(on: &_container, forKey: .identifier) + try intent.encode(on: &_container, forKey: .intent, auxiliaryKey: ._intent) + try note?.encode(on: &_container, forKey: .note) + if let _enum = occurrence { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .occurrencePeriod) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .occurrenceTiming) + } + } + try performer?.encode(on: &_container, forKey: .performer) + try performerType?.encode(on: &_container, forKey: .performerType) + try priority?.encode(on: &_container, forKey: .priority, auxiliaryKey: ._priority) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try relevantHistory?.encode(on: &_container, forKey: .relevantHistory) + try replaces?.encode(on: &_container, forKey: .replaces) + try requester?.encode(on: &_container, forKey: .requester) + try requisition?.encode(on: &_container, forKey: .requisition) + try specimen?.encode(on: &_container, forKey: .specimen) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try supportingInfo?.encode(on: &_container, forKey: .supportingInfo) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ProcedureRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return asNeeded == _other.asNeeded + && authoredOn == _other.authoredOn + && basedOn == _other.basedOn + && bodySite == _other.bodySite + && category == _other.category + && code == _other.code + && context == _other.context + && definition == _other.definition + && doNotPerform == _other.doNotPerform + && identifier == _other.identifier + && intent == _other.intent + && note == _other.note + && occurrence == _other.occurrence + && performer == _other.performer + && performerType == _other.performerType + && priority == _other.priority + && reasonCode == _other.reasonCode + && reasonReference == _other.reasonReference + && relevantHistory == _other.relevantHistory + && replaces == _other.replaces + && requester == _other.requester + && requisition == _other.requisition + && specimen == _other.specimen + && status == _other.status + && subject == _other.subject + && supportingInfo == _other.supportingInfo + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(asNeeded) + hasher.combine(authoredOn) + hasher.combine(basedOn) + hasher.combine(bodySite) + hasher.combine(category) + hasher.combine(code) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(doNotPerform) + hasher.combine(identifier) + hasher.combine(intent) + hasher.combine(note) + hasher.combine(occurrence) + hasher.combine(performer) + hasher.combine(performerType) + hasher.combine(priority) + hasher.combine(reasonCode) + hasher.combine(reasonReference) + hasher.combine(relevantHistory) + hasher.combine(replaces) + hasher.combine(requester) + hasher.combine(requisition) + hasher.combine(specimen) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(supportingInfo) + } +} + +/** + Who/what is requesting procedure or diagnostic. + + The individual who initiated the request and has responsibility for its activation. + */ +open class ProcedureRequestRequester: BackboneElement { + + /// Individual making the request + public var agent: Reference + + /// Organization agent is acting for + public var onBehalfOf: Reference? + + /// Designated initializer taking all required properties + public init(agent: Reference) { + self.agent = agent + super.init() + } + + /// Convenience initializer + public convenience init( + agent: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil) + { + self.init(agent: agent) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case agent + case onBehalfOf + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.agent = try Reference(from: _container, forKey: .agent) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try agent.encode(on: &_container, forKey: .agent) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ProcedureRequestRequester else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return agent == _other.agent + && onBehalfOf == _other.onBehalfOf + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(agent) + hasher.combine(onBehalfOf) + } +} diff --git a/Sources/ModelsSTU3/ProcessRequest.swift b/Sources/ModelsSTU3/ProcessRequest.swift new file mode 100644 index 0000000..a5612c4 --- /dev/null +++ b/Sources/ModelsSTU3/ProcessRequest.swift @@ -0,0 +1,316 @@ +// +// ProcessRequest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ProcessRequest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Request to perform some action on or in regards to an existing resource. + + This resource provides the target, request and response, and action details for an action to be performed by the target + on or about existing resources. + */ +open class ProcessRequest: DomainResource { + + override open class var resourceType: ResourceType { return .processRequest } + + /// Business Identifier + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// The type of processing action being requested, for example Reversal, Readjudication, + /// StatusRequest,PendedRequest. + public var action: FHIRPrimitive? + + /// Party which is the target of the request + public var target: Reference? + + /// Creation date + public var created: FHIRPrimitive? + + /// Responsible practitioner + public var provider: Reference? + + /// Responsible organization + public var organization: Reference? + + /// Reference to the Request resource + public var request: Reference? + + /// Reference to the Response resource + public var response: Reference? + + /// Remove history + public var nullify: FHIRPrimitive? + + /// Reference number/string + public var reference: FHIRPrimitive? + + /// Items to re-adjudicate + public var item: [ProcessRequestItem]? + + /// Resource type(s) to include + public var include: [FHIRPrimitive]? + + /// Resource type(s) to exclude + public var exclude: [FHIRPrimitive]? + + /// Selection period + public var period: Period? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + action: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + exclude: [FHIRPrimitive]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + include: [FHIRPrimitive]? = nil, + item: [ProcessRequestItem]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + nullify: FHIRPrimitive? = nil, + organization: Reference? = nil, + period: Period? = nil, + provider: Reference? = nil, + reference: FHIRPrimitive? = nil, + request: Reference? = nil, + response: Reference? = nil, + status: FHIRPrimitive? = nil, + target: Reference? = nil, + text: Narrative? = nil) + { + self.init() + self.action = action + self.contained = contained + self.created = created + self.exclude = exclude + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.include = include + self.item = item + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.nullify = nullify + self.organization = organization + self.period = period + self.provider = provider + self.reference = reference + self.request = request + self.response = response + self.status = status + self.target = target + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action; case _action + case created; case _created + case exclude; case _exclude + case identifier + case include; case _include + case item + case nullify; case _nullify + case organization + case period + case provider + case reference; case _reference + case request + case response + case status; case _status + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try FHIRPrimitive(from: _container, forKeyIfPresent: .action, auxiliaryKey: ._action) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.exclude = try [FHIRPrimitive](from: _container, forKeyIfPresent: .exclude, auxiliaryKey: ._exclude) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.include = try [FHIRPrimitive](from: _container, forKeyIfPresent: .include, auxiliaryKey: ._include) + self.item = try [ProcessRequestItem](from: _container, forKeyIfPresent: .item) + self.nullify = try FHIRPrimitive(from: _container, forKeyIfPresent: .nullify, auxiliaryKey: ._nullify) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.provider = try Reference(from: _container, forKeyIfPresent: .provider) + self.reference = try FHIRPrimitive(from: _container, forKeyIfPresent: .reference, auxiliaryKey: ._reference) + self.request = try Reference(from: _container, forKeyIfPresent: .request) + self.response = try Reference(from: _container, forKeyIfPresent: .response) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.target = try Reference(from: _container, forKeyIfPresent: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action, auxiliaryKey: ._action) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try exclude?.encode(on: &_container, forKey: .exclude, auxiliaryKey: ._exclude) + try identifier?.encode(on: &_container, forKey: .identifier) + try include?.encode(on: &_container, forKey: .include, auxiliaryKey: ._include) + try item?.encode(on: &_container, forKey: .item) + try nullify?.encode(on: &_container, forKey: .nullify, auxiliaryKey: ._nullify) + try organization?.encode(on: &_container, forKey: .organization) + try period?.encode(on: &_container, forKey: .period) + try provider?.encode(on: &_container, forKey: .provider) + try reference?.encode(on: &_container, forKey: .reference, auxiliaryKey: ._reference) + try request?.encode(on: &_container, forKey: .request) + try response?.encode(on: &_container, forKey: .response) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try target?.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ProcessRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && created == _other.created + && exclude == _other.exclude + && identifier == _other.identifier + && include == _other.include + && item == _other.item + && nullify == _other.nullify + && organization == _other.organization + && period == _other.period + && provider == _other.provider + && reference == _other.reference + && request == _other.request + && response == _other.response + && status == _other.status + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(created) + hasher.combine(exclude) + hasher.combine(identifier) + hasher.combine(include) + hasher.combine(item) + hasher.combine(nullify) + hasher.combine(organization) + hasher.combine(period) + hasher.combine(provider) + hasher.combine(reference) + hasher.combine(request) + hasher.combine(response) + hasher.combine(status) + hasher.combine(target) + } +} + +/** + Items to re-adjudicate. + + List of top level items to be re-adjudicated, if none specified then the entire submission is re-adjudicated. + */ +open class ProcessRequestItem: BackboneElement { + + /// Service instance + public var sequenceLinkId: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(sequenceLinkId: FHIRPrimitive) { + self.sequenceLinkId = sequenceLinkId + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + sequenceLinkId: FHIRPrimitive) + { + self.init(sequenceLinkId: sequenceLinkId) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case sequenceLinkId; case _sequenceLinkId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.sequenceLinkId = try FHIRPrimitive(from: _container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try sequenceLinkId.encode(on: &_container, forKey: .sequenceLinkId, auxiliaryKey: ._sequenceLinkId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ProcessRequestItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return sequenceLinkId == _other.sequenceLinkId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(sequenceLinkId) + } +} diff --git a/Sources/ModelsSTU3/ProcessResponse.swift b/Sources/ModelsSTU3/ProcessResponse.swift new file mode 100644 index 0000000..79c8588 --- /dev/null +++ b/Sources/ModelsSTU3/ProcessResponse.swift @@ -0,0 +1,304 @@ +// +// ProcessResponse.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ProcessResponse) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + ProcessResponse resource. + + This resource provides processing status, errors and notes from the processing of a resource. + */ +open class ProcessResponse: DomainResource { + + override open class var resourceType: ResourceType { return .processResponse } + + /// Business Identifier + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// Creation date + public var created: FHIRPrimitive? + + /// Authoring Organization + public var organization: Reference? + + /// Request reference + public var request: Reference? + + /// Processing outcome + public var outcome: CodeableConcept? + + /// Disposition Message + public var disposition: FHIRPrimitive? + + /// Responsible Practitioner + public var requestProvider: Reference? + + /// Responsible organization + public var requestOrganization: Reference? + + /// Printed Form Identifier + public var form: CodeableConcept? + + /// Processing comments or additional requirements + public var processNote: [ProcessResponseProcessNote]? + + /// Error code + public var error: [CodeableConcept]? + + /// Request for additional information + public var communicationRequest: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + communicationRequest: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + created: FHIRPrimitive? = nil, + disposition: FHIRPrimitive? = nil, + error: [CodeableConcept]? = nil, + `extension`: [Extension]? = nil, + form: CodeableConcept? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + organization: Reference? = nil, + outcome: CodeableConcept? = nil, + processNote: [ProcessResponseProcessNote]? = nil, + request: Reference? = nil, + requestOrganization: Reference? = nil, + requestProvider: Reference? = nil, + status: FHIRPrimitive? = nil, + text: Narrative? = nil) + { + self.init() + self.communicationRequest = communicationRequest + self.contained = contained + self.created = created + self.disposition = disposition + self.error = error + self.`extension` = `extension` + self.form = form + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.organization = organization + self.outcome = outcome + self.processNote = processNote + self.request = request + self.requestOrganization = requestOrganization + self.requestProvider = requestProvider + self.status = status + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case communicationRequest + case created; case _created + case disposition; case _disposition + case error + case form + case identifier + case organization + case outcome + case processNote + case request + case requestOrganization + case requestProvider + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.communicationRequest = try [Reference](from: _container, forKeyIfPresent: .communicationRequest) + self.created = try FHIRPrimitive(from: _container, forKeyIfPresent: .created, auxiliaryKey: ._created) + self.disposition = try FHIRPrimitive(from: _container, forKeyIfPresent: .disposition, auxiliaryKey: ._disposition) + self.error = try [CodeableConcept](from: _container, forKeyIfPresent: .error) + self.form = try CodeableConcept(from: _container, forKeyIfPresent: .form) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.organization = try Reference(from: _container, forKeyIfPresent: .organization) + self.outcome = try CodeableConcept(from: _container, forKeyIfPresent: .outcome) + self.processNote = try [ProcessResponseProcessNote](from: _container, forKeyIfPresent: .processNote) + self.request = try Reference(from: _container, forKeyIfPresent: .request) + self.requestOrganization = try Reference(from: _container, forKeyIfPresent: .requestOrganization) + self.requestProvider = try Reference(from: _container, forKeyIfPresent: .requestProvider) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try communicationRequest?.encode(on: &_container, forKey: .communicationRequest) + try created?.encode(on: &_container, forKey: .created, auxiliaryKey: ._created) + try disposition?.encode(on: &_container, forKey: .disposition, auxiliaryKey: ._disposition) + try error?.encode(on: &_container, forKey: .error) + try form?.encode(on: &_container, forKey: .form) + try identifier?.encode(on: &_container, forKey: .identifier) + try organization?.encode(on: &_container, forKey: .organization) + try outcome?.encode(on: &_container, forKey: .outcome) + try processNote?.encode(on: &_container, forKey: .processNote) + try request?.encode(on: &_container, forKey: .request) + try requestOrganization?.encode(on: &_container, forKey: .requestOrganization) + try requestProvider?.encode(on: &_container, forKey: .requestProvider) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ProcessResponse else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return communicationRequest == _other.communicationRequest + && created == _other.created + && disposition == _other.disposition + && error == _other.error + && form == _other.form + && identifier == _other.identifier + && organization == _other.organization + && outcome == _other.outcome + && processNote == _other.processNote + && request == _other.request + && requestOrganization == _other.requestOrganization + && requestProvider == _other.requestProvider + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(communicationRequest) + hasher.combine(created) + hasher.combine(disposition) + hasher.combine(error) + hasher.combine(form) + hasher.combine(identifier) + hasher.combine(organization) + hasher.combine(outcome) + hasher.combine(processNote) + hasher.combine(request) + hasher.combine(requestOrganization) + hasher.combine(requestProvider) + hasher.combine(status) + } +} + +/** + Processing comments or additional requirements. + + Suite of processing notes or additional requirements if the processing has been held. + */ +open class ProcessResponseProcessNote: BackboneElement { + + /// display | print | printoper + public var type: CodeableConcept? + + /// Comment on the processing + public var text: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + text: FHIRPrimitive? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case text; case _text + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ProcessResponseProcessNote else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return text == _other.text + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(text) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/Provenance.swift b/Sources/ModelsSTU3/Provenance.swift new file mode 100644 index 0000000..36c90a1 --- /dev/null +++ b/Sources/ModelsSTU3/Provenance.swift @@ -0,0 +1,494 @@ +// +// Provenance.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Provenance) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Who, What, When for a set of resources. + + Provenance of a resource is a record that describes entities and processes involved in producing and delivering or + otherwise influencing that resource. Provenance provides a critical foundation for assessing authenticity, enabling + trust, and allowing reproducibility. Provenance assertions are a form of contextual metadata and can themselves become + important records with their own provenance. Provenance statement indicates clinical significance in terms of + confidence in authenticity, reliability, and trustworthiness, integrity, and stage in lifecycle (e.g. Document + Completion - has the artifact been legally authenticated), all of which may impact security, privacy, and trust + policies. + */ +open class Provenance: DomainResource { + + override open class var resourceType: ResourceType { return .provenance } + + /// Target Reference(s) (usually version specific) + public var target: [Reference] + + /// When the activity occurred + public var period: Period? + + /// When the activity was recorded / updated + public var recorded: FHIRPrimitive + + /// Policy or plan the activity was defined by + public var policy: [FHIRPrimitive]? + + /// Where the activity occurred, if relevant + public var location: Reference? + + /// Reason the activity is occurring + public var reason: [Coding]? + + /// Activity that occurred + public var activity: Coding? + + /// Actor involved + public var agent: [ProvenanceAgent] + + /// An entity used in this activity + public var entity: [ProvenanceEntity]? + + /// Signature on target + public var signature: [Signature]? + + /// Designated initializer taking all required properties + public init(agent: [ProvenanceAgent], recorded: FHIRPrimitive, target: [Reference]) { + self.agent = agent + self.recorded = recorded + self.target = target + super.init() + } + + /// Convenience initializer + public convenience init( + activity: Coding? = nil, + agent: [ProvenanceAgent], + contained: [ResourceProxy]? = nil, + entity: [ProvenanceEntity]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + location: Reference? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil, + policy: [FHIRPrimitive]? = nil, + reason: [Coding]? = nil, + recorded: FHIRPrimitive, + signature: [Signature]? = nil, + target: [Reference], + text: Narrative? = nil) + { + self.init(agent: agent, recorded: recorded, target: target) + self.activity = activity + self.contained = contained + self.entity = entity + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.language = language + self.location = location + self.meta = meta + self.modifierExtension = modifierExtension + self.period = period + self.policy = policy + self.reason = reason + self.signature = signature + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case activity + case agent + case entity + case location + case period + case policy; case _policy + case reason + case recorded; case _recorded + case signature + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.activity = try Coding(from: _container, forKeyIfPresent: .activity) + self.agent = try [ProvenanceAgent](from: _container, forKey: .agent) + self.entity = try [ProvenanceEntity](from: _container, forKeyIfPresent: .entity) + self.location = try Reference(from: _container, forKeyIfPresent: .location) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.policy = try [FHIRPrimitive](from: _container, forKeyIfPresent: .policy, auxiliaryKey: ._policy) + self.reason = try [Coding](from: _container, forKeyIfPresent: .reason) + self.recorded = try FHIRPrimitive(from: _container, forKey: .recorded, auxiliaryKey: ._recorded) + self.signature = try [Signature](from: _container, forKeyIfPresent: .signature) + self.target = try [Reference](from: _container, forKey: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try activity?.encode(on: &_container, forKey: .activity) + try agent.encode(on: &_container, forKey: .agent) + try entity?.encode(on: &_container, forKey: .entity) + try location?.encode(on: &_container, forKey: .location) + try period?.encode(on: &_container, forKey: .period) + try policy?.encode(on: &_container, forKey: .policy, auxiliaryKey: ._policy) + try reason?.encode(on: &_container, forKey: .reason) + try recorded.encode(on: &_container, forKey: .recorded, auxiliaryKey: ._recorded) + try signature?.encode(on: &_container, forKey: .signature) + try target.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Provenance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return activity == _other.activity + && agent == _other.agent + && entity == _other.entity + && location == _other.location + && period == _other.period + && policy == _other.policy + && reason == _other.reason + && recorded == _other.recorded + && signature == _other.signature + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(activity) + hasher.combine(agent) + hasher.combine(entity) + hasher.combine(location) + hasher.combine(period) + hasher.combine(policy) + hasher.combine(reason) + hasher.combine(recorded) + hasher.combine(signature) + hasher.combine(target) + } +} + +/** + Actor involved. + + An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity + taking place. + */ +open class ProvenanceAgent: BackboneElement { + + /// All possible types for "onBehalfOf[x]" + public enum OnBehalfOfX: Hashable { + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// All possible types for "who[x]" + public enum WhoX: Hashable { + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// What the agents role was + public var role: [CodeableConcept]? + + /// Who participated + /// One of `who[x]` + public var who: WhoX + + /// Who the agent is representing + /// One of `onBehalfOf[x]` + public var onBehalfOf: OnBehalfOfX? + + /// Type of relationship between agents + public var relatedAgentType: CodeableConcept? + + /// Designated initializer taking all required properties + public init(who: WhoX) { + self.who = who + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: OnBehalfOfX? = nil, + relatedAgentType: CodeableConcept? = nil, + role: [CodeableConcept]? = nil, + who: WhoX) + { + self.init(who: who) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + self.relatedAgentType = relatedAgentType + self.role = role + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case onBehalfOfReference + case onBehalfOfUri; case _onBehalfOfUri + case relatedAgentType + case role + case whoReference + case whoUri; case _whoUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.whoReference) || _container.contains(CodingKeys.whoUri) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.whoReference, CodingKeys.whoUri], debugDescription: "Must have at least one value for \"who\" but have none")) + } + + // Decode all our properties + var _t_onBehalfOf: OnBehalfOfX? = nil + if let onBehalfOfUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .onBehalfOfUri, auxiliaryKey: ._onBehalfOfUri) { + if _t_onBehalfOf != nil { + throw DecodingError.dataCorruptedError(forKey: .onBehalfOfUri, in: _container, debugDescription: "More than one value provided for \"onBehalfOf\"") + } + _t_onBehalfOf = .uri(onBehalfOfUri) + } + if let onBehalfOfReference = try Reference(from: _container, forKeyIfPresent: .onBehalfOfReference) { + if _t_onBehalfOf != nil { + throw DecodingError.dataCorruptedError(forKey: .onBehalfOfReference, in: _container, debugDescription: "More than one value provided for \"onBehalfOf\"") + } + _t_onBehalfOf = .reference(onBehalfOfReference) + } + self.onBehalfOf = _t_onBehalfOf + self.relatedAgentType = try CodeableConcept(from: _container, forKeyIfPresent: .relatedAgentType) + self.role = try [CodeableConcept](from: _container, forKeyIfPresent: .role) + var _t_who: WhoX? = nil + if let whoUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .whoUri, auxiliaryKey: ._whoUri) { + if _t_who != nil { + throw DecodingError.dataCorruptedError(forKey: .whoUri, in: _container, debugDescription: "More than one value provided for \"who\"") + } + _t_who = .uri(whoUri) + } + if let whoReference = try Reference(from: _container, forKeyIfPresent: .whoReference) { + if _t_who != nil { + throw DecodingError.dataCorruptedError(forKey: .whoReference, in: _container, debugDescription: "More than one value provided for \"who\"") + } + _t_who = .reference(whoReference) + } + self.who = _t_who! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = onBehalfOf { + switch _enum { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .onBehalfOfUri, auxiliaryKey: ._onBehalfOfUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .onBehalfOfReference) + } + } + try relatedAgentType?.encode(on: &_container, forKey: .relatedAgentType) + try role?.encode(on: &_container, forKey: .role) + + switch who { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .whoUri, auxiliaryKey: ._whoUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .whoReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ProvenanceAgent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return onBehalfOf == _other.onBehalfOf + && relatedAgentType == _other.relatedAgentType + && role == _other.role + && who == _other.who + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(onBehalfOf) + hasher.combine(relatedAgentType) + hasher.combine(role) + hasher.combine(who) + } +} + +/** + An entity used in this activity. + */ +open class ProvenanceEntity: BackboneElement { + + /// All possible types for "what[x]" + public enum WhatX: Hashable { + case identifier(Identifier) + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// How the entity was used during the activity. + public var role: FHIRPrimitive + + /// Identity of entity + /// One of `what[x]` + public var what: WhatX + + /// Entity is attributed to this agent + public var agent: [ProvenanceAgent]? + + /// Designated initializer taking all required properties + public init(role: FHIRPrimitive, what: WhatX) { + self.role = role + self.what = what + super.init() + } + + /// Convenience initializer + public convenience init( + agent: [ProvenanceAgent]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + role: FHIRPrimitive, + what: WhatX) + { + self.init(role: role, what: what) + self.agent = agent + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case agent + case role; case _role + case whatIdentifier + case whatReference + case whatUri; case _whatUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.whatIdentifier) || _container.contains(CodingKeys.whatReference) || _container.contains(CodingKeys.whatUri) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.whatIdentifier, CodingKeys.whatReference, CodingKeys.whatUri], debugDescription: "Must have at least one value for \"what\" but have none")) + } + + // Decode all our properties + self.agent = try [ProvenanceAgent](from: _container, forKeyIfPresent: .agent) + self.role = try FHIRPrimitive(from: _container, forKey: .role, auxiliaryKey: ._role) + var _t_what: WhatX? = nil + if let whatUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .whatUri, auxiliaryKey: ._whatUri) { + if _t_what != nil { + throw DecodingError.dataCorruptedError(forKey: .whatUri, in: _container, debugDescription: "More than one value provided for \"what\"") + } + _t_what = .uri(whatUri) + } + if let whatReference = try Reference(from: _container, forKeyIfPresent: .whatReference) { + if _t_what != nil { + throw DecodingError.dataCorruptedError(forKey: .whatReference, in: _container, debugDescription: "More than one value provided for \"what\"") + } + _t_what = .reference(whatReference) + } + if let whatIdentifier = try Identifier(from: _container, forKeyIfPresent: .whatIdentifier) { + if _t_what != nil { + throw DecodingError.dataCorruptedError(forKey: .whatIdentifier, in: _container, debugDescription: "More than one value provided for \"what\"") + } + _t_what = .identifier(whatIdentifier) + } + self.what = _t_what! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try agent?.encode(on: &_container, forKey: .agent) + try role.encode(on: &_container, forKey: .role, auxiliaryKey: ._role) + + switch what { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .whatUri, auxiliaryKey: ._whatUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .whatReference) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .whatIdentifier) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ProvenanceEntity else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return agent == _other.agent + && role == _other.role + && what == _other.what + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(agent) + hasher.combine(role) + hasher.combine(what) + } +} diff --git a/Sources/ModelsSTU3/Quantity.swift b/Sources/ModelsSTU3/Quantity.swift new file mode 100644 index 0000000..eaca80f --- /dev/null +++ b/Sources/ModelsSTU3/Quantity.swift @@ -0,0 +1,131 @@ +// +// Quantity.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Quantity) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A measured or measurable amount. + + A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are + not precisely quantified, including amounts involving arbitrary units and floating currencies. + */ +open class Quantity: Element { + + /// Numerical value (with implicit precision) + public var value: FHIRPrimitive? + + /// How the value should be understood and represented - whether the actual value is greater or less than the stated + /// value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value. + public var comparator: FHIRPrimitive? + + /// Unit representation + public var unit: FHIRPrimitive? + + /// System that defines coded unit form + public var system: FHIRPrimitive? + + /// Coded form of the unit + public var code: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive? = nil, + comparator: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + system: FHIRPrimitive? = nil, + unit: FHIRPrimitive? = nil, + value: FHIRPrimitive? = nil) + { + self.init() + self.code = code + self.comparator = comparator + self.`extension` = `extension` + self.id = id + self.system = system + self.unit = unit + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case comparator; case _comparator + case system; case _system + case unit; case _unit + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKeyIfPresent: .code, auxiliaryKey: ._code) + self.comparator = try FHIRPrimitive(from: _container, forKeyIfPresent: .comparator, auxiliaryKey: ._comparator) + self.system = try FHIRPrimitive(from: _container, forKeyIfPresent: .system, auxiliaryKey: ._system) + self.unit = try FHIRPrimitive(from: _container, forKeyIfPresent: .unit, auxiliaryKey: ._unit) + self.value = try FHIRPrimitive(from: _container, forKeyIfPresent: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try comparator?.encode(on: &_container, forKey: .comparator, auxiliaryKey: ._comparator) + try system?.encode(on: &_container, forKey: .system, auxiliaryKey: ._system) + try unit?.encode(on: &_container, forKey: .unit, auxiliaryKey: ._unit) + try value?.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Quantity else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && comparator == _other.comparator + && system == _other.system + && unit == _other.unit + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(comparator) + hasher.combine(system) + hasher.combine(unit) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/Questionnaire.swift b/Sources/ModelsSTU3/Questionnaire.swift new file mode 100644 index 0000000..8d988a6 --- /dev/null +++ b/Sources/ModelsSTU3/Questionnaire.swift @@ -0,0 +1,998 @@ +// +// Questionnaire.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Questionnaire) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A structured set of questions. + + A structured set of questions intended to guide the collection of answers from end-users. Questionnaires provide + detailed control over order, presentation, phraseology and grouping to allow coherent, consistent data collection. + */ +open class Questionnaire: DomainResource { + + override open class var resourceType: ResourceType { return .questionnaire } + + /// Logical URI to reference this questionnaire (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the questionnaire + public var identifier: [Identifier]? + + /// Business version of the questionnaire + public var version: FHIRPrimitive? + + /// Name for this questionnaire (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this questionnaire (human friendly) + public var title: FHIRPrimitive? + + /// The status of this questionnaire. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Natural language description of the questionnaire + public var description_fhir: FHIRPrimitive? + + /// Why this questionnaire is defined + public var purpose: FHIRPrimitive? + + /// When the questionnaire was approved by publisher + public var approvalDate: FHIRPrimitive? + + /// When the questionnaire was last reviewed + public var lastReviewDate: FHIRPrimitive? + + /// When the questionnaire is expected to be used + public var effectivePeriod: Period? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for questionnaire (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Concept that represents the overall questionnaire + public var code: [Coding]? + + /// The types of subjects that can be the subject of responses created for the questionnaire. + public var subjectType: [FHIRPrimitive]? + + /// Questions and sections within the Questionnaire + public var item: [QuestionnaireItem]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + approvalDate: FHIRPrimitive? = nil, + code: [Coding]? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + effectivePeriod: Period? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + item: [QuestionnaireItem]? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + lastReviewDate: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + status: FHIRPrimitive, + subjectType: [FHIRPrimitive]? = nil, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(status: status) + self.approvalDate = approvalDate + self.code = code + self.contact = contact + self.contained = contained + self.copyright = copyright + self.date = date + self.description_fhir = description_fhir + self.effectivePeriod = effectivePeriod + self.experimental = experimental + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.item = item + self.jurisdiction = jurisdiction + self.language = language + self.lastReviewDate = lastReviewDate + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.publisher = publisher + self.purpose = purpose + self.subjectType = subjectType + self.text = text + self.title = title + self.url = url + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case approvalDate; case _approvalDate + case code + case contact + case copyright; case _copyright + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case effectivePeriod + case experimental; case _experimental + case identifier + case item + case jurisdiction + case lastReviewDate; case _lastReviewDate + case name; case _name + case publisher; case _publisher + case purpose; case _purpose + case status; case _status + case subjectType; case _subjectType + case title; case _title + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.approvalDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .approvalDate, auxiliaryKey: ._approvalDate) + self.code = try [Coding](from: _container, forKeyIfPresent: .code) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.item = try [QuestionnaireItem](from: _container, forKeyIfPresent: .item) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.lastReviewDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subjectType = try [FHIRPrimitive](from: _container, forKeyIfPresent: .subjectType, auxiliaryKey: ._subjectType) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try approvalDate?.encode(on: &_container, forKey: .approvalDate, auxiliaryKey: ._approvalDate) + try code?.encode(on: &_container, forKey: .code) + try contact?.encode(on: &_container, forKey: .contact) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try effectivePeriod?.encode(on: &_container, forKey: .effectivePeriod) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try identifier?.encode(on: &_container, forKey: .identifier) + try item?.encode(on: &_container, forKey: .item) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try lastReviewDate?.encode(on: &_container, forKey: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subjectType?.encode(on: &_container, forKey: .subjectType, auxiliaryKey: ._subjectType) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Questionnaire else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return approvalDate == _other.approvalDate + && code == _other.code + && contact == _other.contact + && copyright == _other.copyright + && date == _other.date + && description_fhir == _other.description_fhir + && effectivePeriod == _other.effectivePeriod + && experimental == _other.experimental + && identifier == _other.identifier + && item == _other.item + && jurisdiction == _other.jurisdiction + && lastReviewDate == _other.lastReviewDate + && name == _other.name + && publisher == _other.publisher + && purpose == _other.purpose + && status == _other.status + && subjectType == _other.subjectType + && title == _other.title + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(approvalDate) + hasher.combine(code) + hasher.combine(contact) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(effectivePeriod) + hasher.combine(experimental) + hasher.combine(identifier) + hasher.combine(item) + hasher.combine(jurisdiction) + hasher.combine(lastReviewDate) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(status) + hasher.combine(subjectType) + hasher.combine(title) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Questions and sections within the Questionnaire. + + A particular question, question grouping or display text that is part of the questionnaire. + */ +open class QuestionnaireItem: BackboneElement { + + /// All possible types for "initial[x]" + public enum InitialX: Hashable { + case attachment(Attachment) + case boolean(FHIRPrimitive) + case coding(Coding) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case integer(FHIRPrimitive) + case quantity(Quantity) + case reference(Reference) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// Unique id for item in questionnaire + public var linkId: FHIRPrimitive + + /// ElementDefinition - details for the item + public var definition: FHIRPrimitive? + + /// Corresponding concept for this item in a terminology + public var code: [Coding]? + + /// E.g. "1(a)", "2.5.3" + public var prefix: FHIRPrimitive? + + /// Primary text for the item + public var text: FHIRPrimitive? + + /// The type of questionnaire item this is - whether text for display, a grouping of other items or a particular + /// type of data to be captured (string, integer, coded choice, etc.). + public var type: FHIRPrimitive + + /// Only allow data when + public var enableWhen: [QuestionnaireItemEnableWhen]? + + /// Whether the item must be included in data results + public var required: FHIRPrimitive? + + /// Whether the item may repeat + public var repeats: FHIRPrimitive? + + /// Don't allow human editing + public var readOnly: FHIRPrimitive? + + /// No more than this many characters + public var maxLength: FHIRPrimitive? + + /// Valueset containing permitted answers + public var options: Reference? + + /// Permitted answer + public var option: [QuestionnaireItemOption]? + + /// Default value when item is first rendered + /// One of `initial[x]` + public var initial: InitialX? + + /// Nested questionnaire items + public var item: [QuestionnaireItem]? + + /// Designated initializer taking all required properties + public init(linkId: FHIRPrimitive, type: FHIRPrimitive) { + self.linkId = linkId + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + code: [Coding]? = nil, + definition: FHIRPrimitive? = nil, + enableWhen: [QuestionnaireItemEnableWhen]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + initial: InitialX? = nil, + item: [QuestionnaireItem]? = nil, + linkId: FHIRPrimitive, + maxLength: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + option: [QuestionnaireItemOption]? = nil, + options: Reference? = nil, + prefix: FHIRPrimitive? = nil, + readOnly: FHIRPrimitive? = nil, + repeats: FHIRPrimitive? = nil, + required: FHIRPrimitive? = nil, + text: FHIRPrimitive? = nil, + type: FHIRPrimitive) + { + self.init(linkId: linkId, type: type) + self.code = code + self.definition = definition + self.enableWhen = enableWhen + self.`extension` = `extension` + self.id = id + self.initial = initial + self.item = item + self.maxLength = maxLength + self.modifierExtension = modifierExtension + self.option = option + self.options = options + self.prefix = prefix + self.readOnly = readOnly + self.repeats = repeats + self.required = required + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case definition; case _definition + case enableWhen + case initialAttachment + case initialBoolean; case _initialBoolean + case initialCoding + case initialDate; case _initialDate + case initialDateTime; case _initialDateTime + case initialDecimal; case _initialDecimal + case initialInteger; case _initialInteger + case initialQuantity + case initialReference + case initialString; case _initialString + case initialTime; case _initialTime + case initialUri; case _initialUri + case item + case linkId; case _linkId + case maxLength; case _maxLength + case option + case options + case prefix; case _prefix + case readOnly; case _readOnly + case repeats; case _repeats + case required; case _required + case text; case _text + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try [Coding](from: _container, forKeyIfPresent: .code) + self.definition = try FHIRPrimitive(from: _container, forKeyIfPresent: .definition, auxiliaryKey: ._definition) + self.enableWhen = try [QuestionnaireItemEnableWhen](from: _container, forKeyIfPresent: .enableWhen) + var _t_initial: InitialX? = nil + if let initialBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .initialBoolean, auxiliaryKey: ._initialBoolean) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialBoolean, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .boolean(initialBoolean) + } + if let initialDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .initialDecimal, auxiliaryKey: ._initialDecimal) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialDecimal, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .decimal(initialDecimal) + } + if let initialInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .initialInteger, auxiliaryKey: ._initialInteger) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialInteger, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .integer(initialInteger) + } + if let initialDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .initialDate, auxiliaryKey: ._initialDate) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialDate, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .date(initialDate) + } + if let initialDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .initialDateTime, auxiliaryKey: ._initialDateTime) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialDateTime, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .dateTime(initialDateTime) + } + if let initialTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .initialTime, auxiliaryKey: ._initialTime) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialTime, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .time(initialTime) + } + if let initialString = try FHIRPrimitive(from: _container, forKeyIfPresent: .initialString, auxiliaryKey: ._initialString) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialString, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .string(initialString) + } + if let initialUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .initialUri, auxiliaryKey: ._initialUri) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialUri, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .uri(initialUri) + } + if let initialAttachment = try Attachment(from: _container, forKeyIfPresent: .initialAttachment) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialAttachment, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .attachment(initialAttachment) + } + if let initialCoding = try Coding(from: _container, forKeyIfPresent: .initialCoding) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialCoding, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .coding(initialCoding) + } + if let initialQuantity = try Quantity(from: _container, forKeyIfPresent: .initialQuantity) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialQuantity, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .quantity(initialQuantity) + } + if let initialReference = try Reference(from: _container, forKeyIfPresent: .initialReference) { + if _t_initial != nil { + throw DecodingError.dataCorruptedError(forKey: .initialReference, in: _container, debugDescription: "More than one value provided for \"initial\"") + } + _t_initial = .reference(initialReference) + } + self.initial = _t_initial + self.item = try [QuestionnaireItem](from: _container, forKeyIfPresent: .item) + self.linkId = try FHIRPrimitive(from: _container, forKey: .linkId, auxiliaryKey: ._linkId) + self.maxLength = try FHIRPrimitive(from: _container, forKeyIfPresent: .maxLength, auxiliaryKey: ._maxLength) + self.option = try [QuestionnaireItemOption](from: _container, forKeyIfPresent: .option) + self.options = try Reference(from: _container, forKeyIfPresent: .options) + self.prefix = try FHIRPrimitive(from: _container, forKeyIfPresent: .prefix, auxiliaryKey: ._prefix) + self.readOnly = try FHIRPrimitive(from: _container, forKeyIfPresent: .readOnly, auxiliaryKey: ._readOnly) + self.repeats = try FHIRPrimitive(from: _container, forKeyIfPresent: .repeats, auxiliaryKey: ._repeats) + self.required = try FHIRPrimitive(from: _container, forKeyIfPresent: .required, auxiliaryKey: ._required) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try definition?.encode(on: &_container, forKey: .definition, auxiliaryKey: ._definition) + try enableWhen?.encode(on: &_container, forKey: .enableWhen) + if let _enum = initial { + switch _enum { + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .initialBoolean, auxiliaryKey: ._initialBoolean) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .initialDecimal, auxiliaryKey: ._initialDecimal) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .initialInteger, auxiliaryKey: ._initialInteger) + case .date(let _value): + try _value.encode(on: &_container, forKey: .initialDate, auxiliaryKey: ._initialDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .initialDateTime, auxiliaryKey: ._initialDateTime) + case .time(let _value): + try _value.encode(on: &_container, forKey: .initialTime, auxiliaryKey: ._initialTime) + case .string(let _value): + try _value.encode(on: &_container, forKey: .initialString, auxiliaryKey: ._initialString) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .initialUri, auxiliaryKey: ._initialUri) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .initialAttachment) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .initialCoding) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .initialQuantity) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .initialReference) + } + } + try item?.encode(on: &_container, forKey: .item) + try linkId.encode(on: &_container, forKey: .linkId, auxiliaryKey: ._linkId) + try maxLength?.encode(on: &_container, forKey: .maxLength, auxiliaryKey: ._maxLength) + try option?.encode(on: &_container, forKey: .option) + try options?.encode(on: &_container, forKey: .options) + try prefix?.encode(on: &_container, forKey: .prefix, auxiliaryKey: ._prefix) + try readOnly?.encode(on: &_container, forKey: .readOnly, auxiliaryKey: ._readOnly) + try repeats?.encode(on: &_container, forKey: .repeats, auxiliaryKey: ._repeats) + try required?.encode(on: &_container, forKey: .required, auxiliaryKey: ._required) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? QuestionnaireItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && definition == _other.definition + && enableWhen == _other.enableWhen + && initial == _other.initial + && item == _other.item + && linkId == _other.linkId + && maxLength == _other.maxLength + && option == _other.option + && options == _other.options + && prefix == _other.prefix + && readOnly == _other.readOnly + && repeats == _other.repeats + && required == _other.required + && text == _other.text + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(definition) + hasher.combine(enableWhen) + hasher.combine(initial) + hasher.combine(item) + hasher.combine(linkId) + hasher.combine(maxLength) + hasher.combine(option) + hasher.combine(options) + hasher.combine(prefix) + hasher.combine(readOnly) + hasher.combine(repeats) + hasher.combine(required) + hasher.combine(text) + hasher.combine(type) + } +} + +/** + Only allow data when. + + A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the + specified condition is true. + */ +open class QuestionnaireItemEnableWhen: BackboneElement { + + /// All possible types for "answer[x]" + public enum AnswerX: Hashable { + case attachment(Attachment) + case boolean(FHIRPrimitive) + case coding(Coding) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case integer(FHIRPrimitive) + case quantity(Quantity) + case reference(Reference) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// Question that determines whether item is enabled + public var question: FHIRPrimitive + + /// Enable when answered or not + public var hasAnswer: FHIRPrimitive? + + /// Value question must have + /// One of `answer[x]` + public var answer: AnswerX? + + /// Designated initializer taking all required properties + public init(question: FHIRPrimitive) { + self.question = question + super.init() + } + + /// Convenience initializer + public convenience init( + answer: AnswerX? = nil, + `extension`: [Extension]? = nil, + hasAnswer: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + question: FHIRPrimitive) + { + self.init(question: question) + self.answer = answer + self.`extension` = `extension` + self.hasAnswer = hasAnswer + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case answerAttachment + case answerBoolean; case _answerBoolean + case answerCoding + case answerDate; case _answerDate + case answerDateTime; case _answerDateTime + case answerDecimal; case _answerDecimal + case answerInteger; case _answerInteger + case answerQuantity + case answerReference + case answerString; case _answerString + case answerTime; case _answerTime + case answerUri; case _answerUri + case hasAnswer; case _hasAnswer + case question; case _question + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_answer: AnswerX? = nil + if let answerBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .answerBoolean, auxiliaryKey: ._answerBoolean) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerBoolean, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .boolean(answerBoolean) + } + if let answerDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .answerDecimal, auxiliaryKey: ._answerDecimal) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerDecimal, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .decimal(answerDecimal) + } + if let answerInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .answerInteger, auxiliaryKey: ._answerInteger) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerInteger, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .integer(answerInteger) + } + if let answerDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .answerDate, auxiliaryKey: ._answerDate) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerDate, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .date(answerDate) + } + if let answerDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .answerDateTime, auxiliaryKey: ._answerDateTime) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerDateTime, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .dateTime(answerDateTime) + } + if let answerTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .answerTime, auxiliaryKey: ._answerTime) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerTime, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .time(answerTime) + } + if let answerString = try FHIRPrimitive(from: _container, forKeyIfPresent: .answerString, auxiliaryKey: ._answerString) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerString, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .string(answerString) + } + if let answerUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .answerUri, auxiliaryKey: ._answerUri) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerUri, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .uri(answerUri) + } + if let answerAttachment = try Attachment(from: _container, forKeyIfPresent: .answerAttachment) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerAttachment, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .attachment(answerAttachment) + } + if let answerCoding = try Coding(from: _container, forKeyIfPresent: .answerCoding) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerCoding, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .coding(answerCoding) + } + if let answerQuantity = try Quantity(from: _container, forKeyIfPresent: .answerQuantity) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerQuantity, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .quantity(answerQuantity) + } + if let answerReference = try Reference(from: _container, forKeyIfPresent: .answerReference) { + if _t_answer != nil { + throw DecodingError.dataCorruptedError(forKey: .answerReference, in: _container, debugDescription: "More than one value provided for \"answer\"") + } + _t_answer = .reference(answerReference) + } + self.answer = _t_answer + self.hasAnswer = try FHIRPrimitive(from: _container, forKeyIfPresent: .hasAnswer, auxiliaryKey: ._hasAnswer) + self.question = try FHIRPrimitive(from: _container, forKey: .question, auxiliaryKey: ._question) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = answer { + switch _enum { + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .answerBoolean, auxiliaryKey: ._answerBoolean) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .answerDecimal, auxiliaryKey: ._answerDecimal) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .answerInteger, auxiliaryKey: ._answerInteger) + case .date(let _value): + try _value.encode(on: &_container, forKey: .answerDate, auxiliaryKey: ._answerDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .answerDateTime, auxiliaryKey: ._answerDateTime) + case .time(let _value): + try _value.encode(on: &_container, forKey: .answerTime, auxiliaryKey: ._answerTime) + case .string(let _value): + try _value.encode(on: &_container, forKey: .answerString, auxiliaryKey: ._answerString) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .answerUri, auxiliaryKey: ._answerUri) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .answerAttachment) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .answerCoding) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .answerQuantity) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .answerReference) + } + } + try hasAnswer?.encode(on: &_container, forKey: .hasAnswer, auxiliaryKey: ._hasAnswer) + try question.encode(on: &_container, forKey: .question, auxiliaryKey: ._question) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? QuestionnaireItemEnableWhen else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return answer == _other.answer + && hasAnswer == _other.hasAnswer + && question == _other.question + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(answer) + hasher.combine(hasAnswer) + hasher.combine(question) + } +} + +/** + Permitted answer. + + One of the permitted answers for a "choice" or "open-choice" question. + */ +open class QuestionnaireItemOption: BackboneElement { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case coding(Coding) + case date(FHIRPrimitive) + case integer(FHIRPrimitive) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + } + + /// Answer value + /// One of `value[x]` + public var value: ValueX + + /// Designated initializer taking all required properties + public init(value: ValueX) { + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + value: ValueX) + { + self.init(value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case valueCoding + case valueDate; case _valueDate + case valueInteger; case _valueInteger + case valueString; case _valueString + case valueTime; case _valueTime + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.valueCoding) || _container.contains(CodingKeys.valueDate) || _container.contains(CodingKeys.valueInteger) || _container.contains(CodingKeys.valueString) || _container.contains(CodingKeys.valueTime) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.valueCoding, CodingKeys.valueDate, CodingKeys.valueInteger, CodingKeys.valueString, CodingKeys.valueTime], debugDescription: "Must have at least one value for \"value\" but have none")) + } + + // Decode all our properties + var _t_value: ValueX? = nil + if let valueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInteger, auxiliaryKey: ._valueInteger) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInteger, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .integer(valueInteger) + } + if let valueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDate, auxiliaryKey: ._valueDate) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDate, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .date(valueDate) + } + if let valueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueTime, auxiliaryKey: ._valueTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .time(valueTime) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueCoding = try Coding(from: _container, forKeyIfPresent: .valueCoding) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCoding, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .coding(valueCoding) + } + self.value = _t_value! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + + switch value { + case .integer(let _value): + try _value.encode(on: &_container, forKey: .valueInteger, auxiliaryKey: ._valueInteger) + case .date(let _value): + try _value.encode(on: &_container, forKey: .valueDate, auxiliaryKey: ._valueDate) + case .time(let _value): + try _value.encode(on: &_container, forKey: .valueTime, auxiliaryKey: ._valueTime) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .valueCoding) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? QuestionnaireItemOption else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/QuestionnaireResponse.swift b/Sources/ModelsSTU3/QuestionnaireResponse.swift new file mode 100644 index 0000000..166b782 --- /dev/null +++ b/Sources/ModelsSTU3/QuestionnaireResponse.swift @@ -0,0 +1,534 @@ +// +// QuestionnaireResponse.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A structured set of questions and their answers. + + A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, + corresponding to the structure of the grouping of the questionnaire being responded to. + */ +open class QuestionnaireResponse: DomainResource { + + override open class var resourceType: ResourceType { return .questionnaireResponse } + + /// Unique id for this set of answers + public var identifier: Identifier? + + /// Request fulfilled by this QuestionnaireResponse + public var basedOn: [Reference]? + + /// Part of this action + public var parent: [Reference]? + + /// Form being answered + public var questionnaire: Reference? + + /// The position of the questionnaire response within its overall lifecycle. + public var status: FHIRPrimitive + + /// The subject of the questions + public var subject: Reference? + + /// Encounter or Episode during which questionnaire was completed + public var context: Reference? + + /// Date the answers were gathered + public var authored: FHIRPrimitive? + + /// Person who received and recorded the answers + public var author: Reference? + + /// The person who answered the questions + public var source: Reference? + + /// Groups and questions + public var item: [QuestionnaireResponseItem]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + author: Reference? = nil, + authored: FHIRPrimitive? = nil, + basedOn: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + item: [QuestionnaireResponseItem]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + parent: [Reference]? = nil, + questionnaire: Reference? = nil, + source: Reference? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil) + { + self.init(status: status) + self.author = author + self.authored = authored + self.basedOn = basedOn + self.contained = contained + self.context = context + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.item = item + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.parent = parent + self.questionnaire = questionnaire + self.source = source + self.subject = subject + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case author + case authored; case _authored + case basedOn + case context + case identifier + case item + case parent + case questionnaire + case source + case status; case _status + case subject + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.author = try Reference(from: _container, forKeyIfPresent: .author) + self.authored = try FHIRPrimitive(from: _container, forKeyIfPresent: .authored, auxiliaryKey: ._authored) + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.item = try [QuestionnaireResponseItem](from: _container, forKeyIfPresent: .item) + self.parent = try [Reference](from: _container, forKeyIfPresent: .parent) + self.questionnaire = try Reference(from: _container, forKeyIfPresent: .questionnaire) + self.source = try Reference(from: _container, forKeyIfPresent: .source) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try author?.encode(on: &_container, forKey: .author) + try authored?.encode(on: &_container, forKey: .authored, auxiliaryKey: ._authored) + try basedOn?.encode(on: &_container, forKey: .basedOn) + try context?.encode(on: &_container, forKey: .context) + try identifier?.encode(on: &_container, forKey: .identifier) + try item?.encode(on: &_container, forKey: .item) + try parent?.encode(on: &_container, forKey: .parent) + try questionnaire?.encode(on: &_container, forKey: .questionnaire) + try source?.encode(on: &_container, forKey: .source) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? QuestionnaireResponse else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return author == _other.author + && authored == _other.authored + && basedOn == _other.basedOn + && context == _other.context + && identifier == _other.identifier + && item == _other.item + && parent == _other.parent + && questionnaire == _other.questionnaire + && source == _other.source + && status == _other.status + && subject == _other.subject + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(author) + hasher.combine(authored) + hasher.combine(basedOn) + hasher.combine(context) + hasher.combine(identifier) + hasher.combine(item) + hasher.combine(parent) + hasher.combine(questionnaire) + hasher.combine(source) + hasher.combine(status) + hasher.combine(subject) + } +} + +/** + Groups and questions. + + A group or question item from the original questionnaire for which answers are provided. + */ +open class QuestionnaireResponseItem: BackboneElement { + + /// Pointer to specific item from Questionnaire + public var linkId: FHIRPrimitive + + /// ElementDefinition - details for the item + public var definition: FHIRPrimitive? + + /// Name for group or question text + public var text: FHIRPrimitive? + + /// The subject this group's answers are about + public var subject: Reference? + + /// The response(s) to the question + public var answer: [QuestionnaireResponseItemAnswer]? + + /// Nested questionnaire response items + public var item: [QuestionnaireResponseItem]? + + /// Designated initializer taking all required properties + public init(linkId: FHIRPrimitive) { + self.linkId = linkId + super.init() + } + + /// Convenience initializer + public convenience init( + answer: [QuestionnaireResponseItemAnswer]? = nil, + definition: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + item: [QuestionnaireResponseItem]? = nil, + linkId: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + subject: Reference? = nil, + text: FHIRPrimitive? = nil) + { + self.init(linkId: linkId) + self.answer = answer + self.definition = definition + self.`extension` = `extension` + self.id = id + self.item = item + self.modifierExtension = modifierExtension + self.subject = subject + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case answer + case definition; case _definition + case item + case linkId; case _linkId + case subject + case text; case _text + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.answer = try [QuestionnaireResponseItemAnswer](from: _container, forKeyIfPresent: .answer) + self.definition = try FHIRPrimitive(from: _container, forKeyIfPresent: .definition, auxiliaryKey: ._definition) + self.item = try [QuestionnaireResponseItem](from: _container, forKeyIfPresent: .item) + self.linkId = try FHIRPrimitive(from: _container, forKey: .linkId, auxiliaryKey: ._linkId) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + self.text = try FHIRPrimitive(from: _container, forKeyIfPresent: .text, auxiliaryKey: ._text) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try answer?.encode(on: &_container, forKey: .answer) + try definition?.encode(on: &_container, forKey: .definition, auxiliaryKey: ._definition) + try item?.encode(on: &_container, forKey: .item) + try linkId.encode(on: &_container, forKey: .linkId, auxiliaryKey: ._linkId) + try subject?.encode(on: &_container, forKey: .subject) + try text?.encode(on: &_container, forKey: .text, auxiliaryKey: ._text) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? QuestionnaireResponseItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return answer == _other.answer + && definition == _other.definition + && item == _other.item + && linkId == _other.linkId + && subject == _other.subject + && text == _other.text + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(answer) + hasher.combine(definition) + hasher.combine(item) + hasher.combine(linkId) + hasher.combine(subject) + hasher.combine(text) + } +} + +/** + The response(s) to the question. + + The respondent's answer(s) to the question. + */ +open class QuestionnaireResponseItemAnswer: BackboneElement { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case attachment(Attachment) + case boolean(FHIRPrimitive) + case coding(Coding) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case integer(FHIRPrimitive) + case quantity(Quantity) + case reference(Reference) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// Single-valued answer to the question + /// One of `value[x]` + public var value: ValueX? + + /// Nested groups and questions + public var item: [QuestionnaireResponseItem]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + item: [QuestionnaireResponseItem]? = nil, + modifierExtension: [Extension]? = nil, + value: ValueX? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.item = item + self.modifierExtension = modifierExtension + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case item + case valueAttachment + case valueBoolean; case _valueBoolean + case valueCoding + case valueDate; case _valueDate + case valueDateTime; case _valueDateTime + case valueDecimal; case _valueDecimal + case valueInteger; case _valueInteger + case valueQuantity + case valueReference + case valueString; case _valueString + case valueTime; case _valueTime + case valueUri; case _valueUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.item = try [QuestionnaireResponseItem](from: _container, forKeyIfPresent: .item) + var _t_value: ValueX? = nil + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDecimal, auxiliaryKey: ._valueDecimal) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDecimal, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .decimal(valueDecimal) + } + if let valueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInteger, auxiliaryKey: ._valueInteger) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInteger, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .integer(valueInteger) + } + if let valueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDate, auxiliaryKey: ._valueDate) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDate, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .date(valueDate) + } + if let valueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDateTime, auxiliaryKey: ._valueDateTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDateTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .dateTime(valueDateTime) + } + if let valueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueTime, auxiliaryKey: ._valueTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .time(valueTime) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUri, auxiliaryKey: ._valueUri) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUri, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .uri(valueUri) + } + if let valueAttachment = try Attachment(from: _container, forKeyIfPresent: .valueAttachment) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAttachment, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .attachment(valueAttachment) + } + if let valueCoding = try Coding(from: _container, forKeyIfPresent: .valueCoding) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCoding, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .coding(valueCoding) + } + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueReference = try Reference(from: _container, forKeyIfPresent: .valueReference) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueReference, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .reference(valueReference) + } + self.value = _t_value + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try item?.encode(on: &_container, forKey: .item) + if let _enum = value { + switch _enum { + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .valueDecimal, auxiliaryKey: ._valueDecimal) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .valueInteger, auxiliaryKey: ._valueInteger) + case .date(let _value): + try _value.encode(on: &_container, forKey: .valueDate, auxiliaryKey: ._valueDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .valueDateTime, auxiliaryKey: ._valueDateTime) + case .time(let _value): + try _value.encode(on: &_container, forKey: .valueTime, auxiliaryKey: ._valueTime) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .valueUri, auxiliaryKey: ._valueUri) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .valueAttachment) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .valueCoding) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueReference) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? QuestionnaireResponseItemAnswer else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return item == _other.item + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(item) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/Range.swift b/Sources/ModelsSTU3/Range.swift new file mode 100644 index 0000000..a5b6900 --- /dev/null +++ b/Sources/ModelsSTU3/Range.swift @@ -0,0 +1,99 @@ +// +// Range.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Range) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Set of values bounded by low and high. + + A set of ordered Quantities defined by a low and high limit. + */ +open class Range: Element { + + /// Low limit + public var low: Quantity? + + /// High limit + public var high: Quantity? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + high: Quantity? = nil, + id: FHIRPrimitive? = nil, + low: Quantity? = nil) + { + self.init() + self.`extension` = `extension` + self.high = high + self.id = id + self.low = low + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case high + case low + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.high = try Quantity(from: _container, forKeyIfPresent: .high) + self.low = try Quantity(from: _container, forKeyIfPresent: .low) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try high?.encode(on: &_container, forKey: .high) + try low?.encode(on: &_container, forKey: .low) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Range else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return high == _other.high + && low == _other.low + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(high) + hasher.combine(low) + } +} diff --git a/Sources/ModelsSTU3/Ratio.swift b/Sources/ModelsSTU3/Ratio.swift new file mode 100644 index 0000000..24bc476 --- /dev/null +++ b/Sources/ModelsSTU3/Ratio.swift @@ -0,0 +1,99 @@ +// +// Ratio.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Ratio) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A ratio of two Quantity values - a numerator and a denominator. + + A relationship of two Quantity values - expressed as a numerator and a denominator. + */ +open class Ratio: Element { + + /// Numerator value + public var numerator: Quantity? + + /// Denominator value + public var denominator: Quantity? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + denominator: Quantity? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + numerator: Quantity? = nil) + { + self.init() + self.denominator = denominator + self.`extension` = `extension` + self.id = id + self.numerator = numerator + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case denominator + case numerator + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.denominator = try Quantity(from: _container, forKeyIfPresent: .denominator) + self.numerator = try Quantity(from: _container, forKeyIfPresent: .numerator) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try denominator?.encode(on: &_container, forKey: .denominator) + try numerator?.encode(on: &_container, forKey: .numerator) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Ratio else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return denominator == _other.denominator + && numerator == _other.numerator + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(denominator) + hasher.combine(numerator) + } +} diff --git a/Sources/ModelsSTU3/Reference.swift b/Sources/ModelsSTU3/Reference.swift new file mode 100644 index 0000000..15afc12 --- /dev/null +++ b/Sources/ModelsSTU3/Reference.swift @@ -0,0 +1,107 @@ +// +// Reference.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Reference) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A reference from one resource to another. + */ +open class Reference: Element { + + /// Literal reference, Relative, internal or absolute URL + public var reference: FHIRPrimitive? + + /// Logical reference, when literal reference is not known + public var identifier: Identifier? + + /// Text alternative for the resource + public var display: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + display: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + reference: FHIRPrimitive? = nil) + { + self.init() + self.display = display + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.reference = reference + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case display; case _display + case identifier + case reference; case _reference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.reference = try FHIRPrimitive(from: _container, forKeyIfPresent: .reference, auxiliaryKey: ._reference) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try identifier?.encode(on: &_container, forKey: .identifier) + try reference?.encode(on: &_container, forKey: .reference, auxiliaryKey: ._reference) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Reference else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return display == _other.display + && identifier == _other.identifier + && reference == _other.reference + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(display) + hasher.combine(identifier) + hasher.combine(reference) + } +} diff --git a/Sources/ModelsSTU3/ReferralRequest.swift b/Sources/ModelsSTU3/ReferralRequest.swift new file mode 100644 index 0000000..8ad9a6a --- /dev/null +++ b/Sources/ModelsSTU3/ReferralRequest.swift @@ -0,0 +1,433 @@ +// +// ReferralRequest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ReferralRequest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A request for referral or transfer of care. + + Used to record and send details about a request for referral service or transfer of a patient to the care of another + provider or provider organization. + */ +open class ReferralRequest: DomainResource { + + override open class var resourceType: ResourceType { return .referralRequest } + + /// All possible types for "occurrence[x]" + public enum OccurrenceX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// Business identifier + public var identifier: [Identifier]? + + /// Instantiates protocol or definition + public var definition: [Reference]? + + /// Request fulfilled by this request + public var basedOn: [Reference]? + + /// Request(s) replaced by this request + public var replaces: [Reference]? + + /// Composite request this is part of + public var groupIdentifier: Identifier? + + /// The status of the authorization/intention reflected by the referral request record. + public var status: FHIRPrimitive + + /// Distinguishes the "level" of authorization/demand implicit in this request. + public var intent: FHIRPrimitive + + /// Referral/Transition of care request type + public var type: CodeableConcept? + + /// An indication of the urgency of referral (or where applicable the type of transfer of care) request. + public var priority: FHIRPrimitive? + + /// Actions requested as part of the referral + public var serviceRequested: [CodeableConcept]? + + /// Patient referred to care or transfer + public var subject: Reference + + /// Originating encounter + public var context: Reference? + + /// When the service(s) requested in the referral should occur + /// One of `occurrence[x]` + public var occurrence: OccurrenceX? + + /// Date of creation/activation + public var authoredOn: FHIRPrimitive? + + /// Who/what is requesting service + public var requester: ReferralRequestRequester? + + /// The clinical specialty (discipline) that the referral is requested for + public var specialty: CodeableConcept? + + /// Receiver of referral / transfer of care request + public var recipient: [Reference]? + + /// Reason for referral / transfer of care request + public var reasonCode: [CodeableConcept]? + + /// Why is service needed? + public var reasonReference: [Reference]? + + /// A textual description of the referral + public var description_fhir: FHIRPrimitive? + + /// Additonal information to support referral or transfer of care request + public var supportingInfo: [Reference]? + + /// Comments made about referral request + public var note: [Annotation]? + + /// Key events in history of request + public var relevantHistory: [Reference]? + + /// Designated initializer taking all required properties + public init(intent: FHIRPrimitive, status: FHIRPrimitive, subject: Reference) { + self.intent = intent + self.status = status + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + authoredOn: FHIRPrimitive? = nil, + basedOn: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: [Reference]? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + groupIdentifier: Identifier? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + intent: FHIRPrimitive, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + occurrence: OccurrenceX? = nil, + priority: FHIRPrimitive? = nil, + reasonCode: [CodeableConcept]? = nil, + reasonReference: [Reference]? = nil, + recipient: [Reference]? = nil, + relevantHistory: [Reference]? = nil, + replaces: [Reference]? = nil, + requester: ReferralRequestRequester? = nil, + serviceRequested: [CodeableConcept]? = nil, + specialty: CodeableConcept? = nil, + status: FHIRPrimitive, + subject: Reference, + supportingInfo: [Reference]? = nil, + text: Narrative? = nil, + type: CodeableConcept? = nil) + { + self.init(intent: intent, status: status, subject: subject) + self.authoredOn = authoredOn + self.basedOn = basedOn + self.contained = contained + self.context = context + self.definition = definition + self.description_fhir = description_fhir + self.`extension` = `extension` + self.groupIdentifier = groupIdentifier + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.occurrence = occurrence + self.priority = priority + self.reasonCode = reasonCode + self.reasonReference = reasonReference + self.recipient = recipient + self.relevantHistory = relevantHistory + self.replaces = replaces + self.requester = requester + self.serviceRequested = serviceRequested + self.specialty = specialty + self.supportingInfo = supportingInfo + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authoredOn; case _authoredOn + case basedOn + case context + case definition + case description_fhir = "description"; case _description_fhir = "_description" + case groupIdentifier + case identifier + case intent; case _intent + case note + case occurrenceDateTime; case _occurrenceDateTime + case occurrencePeriod + case priority; case _priority + case reasonCode + case reasonReference + case recipient + case relevantHistory + case replaces + case requester + case serviceRequested + case specialty + case status; case _status + case subject + case supportingInfo + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.authoredOn = try FHIRPrimitive(from: _container, forKeyIfPresent: .authoredOn, auxiliaryKey: ._authoredOn) + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.definition = try [Reference](from: _container, forKeyIfPresent: .definition) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.groupIdentifier = try Identifier(from: _container, forKeyIfPresent: .groupIdentifier) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.intent = try FHIRPrimitive(from: _container, forKey: .intent, auxiliaryKey: ._intent) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + var _t_occurrence: OccurrenceX? = nil + if let occurrenceDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceDateTime, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .dateTime(occurrenceDateTime) + } + if let occurrencePeriod = try Period(from: _container, forKeyIfPresent: .occurrencePeriod) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrencePeriod, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .period(occurrencePeriod) + } + self.occurrence = _t_occurrence + self.priority = try FHIRPrimitive(from: _container, forKeyIfPresent: .priority, auxiliaryKey: ._priority) + self.reasonCode = try [CodeableConcept](from: _container, forKeyIfPresent: .reasonCode) + self.reasonReference = try [Reference](from: _container, forKeyIfPresent: .reasonReference) + self.recipient = try [Reference](from: _container, forKeyIfPresent: .recipient) + self.relevantHistory = try [Reference](from: _container, forKeyIfPresent: .relevantHistory) + self.replaces = try [Reference](from: _container, forKeyIfPresent: .replaces) + self.requester = try ReferralRequestRequester(from: _container, forKeyIfPresent: .requester) + self.serviceRequested = try [CodeableConcept](from: _container, forKeyIfPresent: .serviceRequested) + self.specialty = try CodeableConcept(from: _container, forKeyIfPresent: .specialty) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.supportingInfo = try [Reference](from: _container, forKeyIfPresent: .supportingInfo) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authoredOn?.encode(on: &_container, forKey: .authoredOn, auxiliaryKey: ._authoredOn) + try basedOn?.encode(on: &_container, forKey: .basedOn) + try context?.encode(on: &_container, forKey: .context) + try definition?.encode(on: &_container, forKey: .definition) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try groupIdentifier?.encode(on: &_container, forKey: .groupIdentifier) + try identifier?.encode(on: &_container, forKey: .identifier) + try intent.encode(on: &_container, forKey: .intent, auxiliaryKey: ._intent) + try note?.encode(on: &_container, forKey: .note) + if let _enum = occurrence { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .occurrencePeriod) + } + } + try priority?.encode(on: &_container, forKey: .priority, auxiliaryKey: ._priority) + try reasonCode?.encode(on: &_container, forKey: .reasonCode) + try reasonReference?.encode(on: &_container, forKey: .reasonReference) + try recipient?.encode(on: &_container, forKey: .recipient) + try relevantHistory?.encode(on: &_container, forKey: .relevantHistory) + try replaces?.encode(on: &_container, forKey: .replaces) + try requester?.encode(on: &_container, forKey: .requester) + try serviceRequested?.encode(on: &_container, forKey: .serviceRequested) + try specialty?.encode(on: &_container, forKey: .specialty) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try supportingInfo?.encode(on: &_container, forKey: .supportingInfo) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ReferralRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authoredOn == _other.authoredOn + && basedOn == _other.basedOn + && context == _other.context + && definition == _other.definition + && description_fhir == _other.description_fhir + && groupIdentifier == _other.groupIdentifier + && identifier == _other.identifier + && intent == _other.intent + && note == _other.note + && occurrence == _other.occurrence + && priority == _other.priority + && reasonCode == _other.reasonCode + && reasonReference == _other.reasonReference + && recipient == _other.recipient + && relevantHistory == _other.relevantHistory + && replaces == _other.replaces + && requester == _other.requester + && serviceRequested == _other.serviceRequested + && specialty == _other.specialty + && status == _other.status + && subject == _other.subject + && supportingInfo == _other.supportingInfo + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authoredOn) + hasher.combine(basedOn) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(description_fhir) + hasher.combine(groupIdentifier) + hasher.combine(identifier) + hasher.combine(intent) + hasher.combine(note) + hasher.combine(occurrence) + hasher.combine(priority) + hasher.combine(reasonCode) + hasher.combine(reasonReference) + hasher.combine(recipient) + hasher.combine(relevantHistory) + hasher.combine(replaces) + hasher.combine(requester) + hasher.combine(serviceRequested) + hasher.combine(specialty) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(supportingInfo) + hasher.combine(type) + } +} + +/** + Who/what is requesting service. + + The individual who initiated the request and has responsibility for its activation. + */ +open class ReferralRequestRequester: BackboneElement { + + /// Individual making the request + public var agent: Reference + + /// Organization agent is acting for + public var onBehalfOf: Reference? + + /// Designated initializer taking all required properties + public init(agent: Reference) { + self.agent = agent + super.init() + } + + /// Convenience initializer + public convenience init( + agent: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil) + { + self.init(agent: agent) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case agent + case onBehalfOf + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.agent = try Reference(from: _container, forKey: .agent) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try agent.encode(on: &_container, forKey: .agent) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ReferralRequestRequester else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return agent == _other.agent + && onBehalfOf == _other.onBehalfOf + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(agent) + hasher.combine(onBehalfOf) + } +} diff --git a/Sources/ModelsSTU3/RelatedArtifact.swift b/Sources/ModelsSTU3/RelatedArtifact.swift new file mode 100644 index 0000000..3235816 --- /dev/null +++ b/Sources/ModelsSTU3/RelatedArtifact.swift @@ -0,0 +1,139 @@ +// +// RelatedArtifact.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/RelatedArtifact) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Related artifacts for a knowledge resource. + + Related artifacts such as additional documentation, justification, or bibliographic references. + */ +open class RelatedArtifact: Element { + + /// The type of relationship to the related artifact. + public var type: FHIRPrimitive + + /// Brief description of the related artifact + public var display: FHIRPrimitive? + + /// Bibliographic citation for the artifact + public var citation: FHIRPrimitive? + + /// Where the artifact can be accessed + public var url: FHIRPrimitive? + + /// What document is being referenced + public var document: Attachment? + + /// What resource is being referenced + public var resource: Reference? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + citation: FHIRPrimitive? = nil, + display: FHIRPrimitive? = nil, + document: Attachment? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + resource: Reference? = nil, + type: FHIRPrimitive, + url: FHIRPrimitive? = nil) + { + self.init(type: type) + self.citation = citation + self.display = display + self.document = document + self.`extension` = `extension` + self.id = id + self.resource = resource + self.url = url + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case citation; case _citation + case display; case _display + case document + case resource + case type; case _type + case url; case _url + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.citation = try FHIRPrimitive(from: _container, forKeyIfPresent: .citation, auxiliaryKey: ._citation) + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + self.document = try Attachment(from: _container, forKeyIfPresent: .document) + self.resource = try Reference(from: _container, forKeyIfPresent: .resource) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try citation?.encode(on: &_container, forKey: .citation, auxiliaryKey: ._citation) + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try document?.encode(on: &_container, forKey: .document) + try resource?.encode(on: &_container, forKey: .resource) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? RelatedArtifact else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return citation == _other.citation + && display == _other.display + && document == _other.document + && resource == _other.resource + && type == _other.type + && url == _other.url + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(citation) + hasher.combine(display) + hasher.combine(document) + hasher.combine(resource) + hasher.combine(type) + hasher.combine(url) + } +} diff --git a/Sources/ModelsSTU3/RelatedPerson.swift b/Sources/ModelsSTU3/RelatedPerson.swift new file mode 100644 index 0000000..484357a --- /dev/null +++ b/Sources/ModelsSTU3/RelatedPerson.swift @@ -0,0 +1,205 @@ +// +// RelatedPerson.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/RelatedPerson) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + An person that is related to a patient, but who is not a direct target of care. + + Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has + a formal responsibility in the care process. + */ +open class RelatedPerson: DomainResource { + + override open class var resourceType: ResourceType { return .relatedPerson } + + /// A human identifier for this person + public var identifier: [Identifier]? + + /// Whether this related person's record is in active use + public var active: FHIRPrimitive? + + /// The patient this person is related to + public var patient: Reference + + /// The nature of the relationship + public var relationship: CodeableConcept? + + /// A name associated with the person + public var name: [HumanName]? + + /// A contact detail for the person + public var telecom: [ContactPoint]? + + /// Administrative Gender - the gender that the person is considered to have for administration and record keeping + /// purposes. + public var gender: FHIRPrimitive? + + /// The date on which the related person was born + public var birthDate: FHIRPrimitive? + + /// Address where the related person can be contacted or visited + public var address: [Address]? + + /// Image of the person + public var photo: [Attachment]? + + /// Period of time that this relationship is considered valid + public var period: Period? + + /// Designated initializer taking all required properties + public init(patient: Reference) { + self.patient = patient + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + address: [Address]? = nil, + birthDate: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + gender: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: [HumanName]? = nil, + patient: Reference, + period: Period? = nil, + photo: [Attachment]? = nil, + relationship: CodeableConcept? = nil, + telecom: [ContactPoint]? = nil, + text: Narrative? = nil) + { + self.init(patient: patient) + self.active = active + self.address = address + self.birthDate = birthDate + self.contained = contained + self.`extension` = `extension` + self.gender = gender + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.period = period + self.photo = photo + self.relationship = relationship + self.telecom = telecom + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case address + case birthDate; case _birthDate + case gender; case _gender + case identifier + case name + case patient + case period + case photo + case relationship + case telecom + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.address = try [Address](from: _container, forKeyIfPresent: .address) + self.birthDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .birthDate, auxiliaryKey: ._birthDate) + self.gender = try FHIRPrimitive(from: _container, forKeyIfPresent: .gender, auxiliaryKey: ._gender) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.name = try [HumanName](from: _container, forKeyIfPresent: .name) + self.patient = try Reference(from: _container, forKey: .patient) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.photo = try [Attachment](from: _container, forKeyIfPresent: .photo) + self.relationship = try CodeableConcept(from: _container, forKeyIfPresent: .relationship) + self.telecom = try [ContactPoint](from: _container, forKeyIfPresent: .telecom) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try address?.encode(on: &_container, forKey: .address) + try birthDate?.encode(on: &_container, forKey: .birthDate, auxiliaryKey: ._birthDate) + try gender?.encode(on: &_container, forKey: .gender, auxiliaryKey: ._gender) + try identifier?.encode(on: &_container, forKey: .identifier) + try name?.encode(on: &_container, forKey: .name) + try patient.encode(on: &_container, forKey: .patient) + try period?.encode(on: &_container, forKey: .period) + try photo?.encode(on: &_container, forKey: .photo) + try relationship?.encode(on: &_container, forKey: .relationship) + try telecom?.encode(on: &_container, forKey: .telecom) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? RelatedPerson else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && address == _other.address + && birthDate == _other.birthDate + && gender == _other.gender + && identifier == _other.identifier + && name == _other.name + && patient == _other.patient + && period == _other.period + && photo == _other.photo + && relationship == _other.relationship + && telecom == _other.telecom + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(address) + hasher.combine(birthDate) + hasher.combine(gender) + hasher.combine(identifier) + hasher.combine(name) + hasher.combine(patient) + hasher.combine(period) + hasher.combine(photo) + hasher.combine(relationship) + hasher.combine(telecom) + } +} diff --git a/Sources/ModelsSTU3/RequestGroup.swift b/Sources/ModelsSTU3/RequestGroup.swift new file mode 100644 index 0000000..f979c41 --- /dev/null +++ b/Sources/ModelsSTU3/RequestGroup.swift @@ -0,0 +1,793 @@ +// +// RequestGroup.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/RequestGroup) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A group of related requests. + + A group of related requests that can be used to capture intended activities that have inter-dependencies such as "give + this medication after that one". + */ +open class RequestGroup: DomainResource { + + override open class var resourceType: ResourceType { return .requestGroup } + + /// All possible types for "reason[x]" + public enum ReasonX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Business identifier + public var identifier: [Identifier]? + + /// Instantiates protocol or definition + public var definition: [Reference]? + + /// Fulfills plan, proposal, or order + public var basedOn: [Reference]? + + /// Request(s) replaced by this request + public var replaces: [Reference]? + + /// Composite request this is part of + public var groupIdentifier: Identifier? + + /// The current state of the request. For request groups, the status reflects the status of all the requests in the + /// group. + public var status: FHIRPrimitive + + /// Indicates the level of authority/intentionality associated with the request and where the request fits into the + /// workflow chain. + public var intent: FHIRPrimitive + + /// Indicates how quickly the request should be addressed with respect to other requests. + public var priority: FHIRPrimitive? + + /// Who the request group is about + public var subject: Reference? + + /// Encounter or Episode for the request group + public var context: Reference? + + /// When the request group was authored + public var authoredOn: FHIRPrimitive? + + /// Device or practitioner that authored the request group + public var author: Reference? + + /// Reason for the request group + /// One of `reason[x]` + public var reason: ReasonX? + + /// Additional notes about the response + public var note: [Annotation]? + + /// Proposed actions, if any + public var action: [RequestGroupAction]? + + /// Designated initializer taking all required properties + public init(intent: FHIRPrimitive, status: FHIRPrimitive) { + self.intent = intent + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + action: [RequestGroupAction]? = nil, + author: Reference? = nil, + authoredOn: FHIRPrimitive? = nil, + basedOn: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: [Reference]? = nil, + `extension`: [Extension]? = nil, + groupIdentifier: Identifier? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + intent: FHIRPrimitive, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + priority: FHIRPrimitive? = nil, + reason: ReasonX? = nil, + replaces: [Reference]? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil) + { + self.init(intent: intent, status: status) + self.action = action + self.author = author + self.authoredOn = authoredOn + self.basedOn = basedOn + self.contained = contained + self.context = context + self.definition = definition + self.`extension` = `extension` + self.groupIdentifier = groupIdentifier + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.priority = priority + self.reason = reason + self.replaces = replaces + self.subject = subject + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case author + case authoredOn; case _authoredOn + case basedOn + case context + case definition + case groupIdentifier + case identifier + case intent; case _intent + case note + case priority; case _priority + case reasonCodeableConcept + case reasonReference + case replaces + case status; case _status + case subject + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [RequestGroupAction](from: _container, forKeyIfPresent: .action) + self.author = try Reference(from: _container, forKeyIfPresent: .author) + self.authoredOn = try FHIRPrimitive(from: _container, forKeyIfPresent: .authoredOn, auxiliaryKey: ._authoredOn) + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.definition = try [Reference](from: _container, forKeyIfPresent: .definition) + self.groupIdentifier = try Identifier(from: _container, forKeyIfPresent: .groupIdentifier) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.intent = try FHIRPrimitive(from: _container, forKey: .intent, auxiliaryKey: ._intent) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.priority = try FHIRPrimitive(from: _container, forKeyIfPresent: .priority, auxiliaryKey: ._priority) + var _t_reason: ReasonX? = nil + if let reasonCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .reasonCodeableConcept) { + if _t_reason != nil { + throw DecodingError.dataCorruptedError(forKey: .reasonCodeableConcept, in: _container, debugDescription: "More than one value provided for \"reason\"") + } + _t_reason = .codeableConcept(reasonCodeableConcept) + } + if let reasonReference = try Reference(from: _container, forKeyIfPresent: .reasonReference) { + if _t_reason != nil { + throw DecodingError.dataCorruptedError(forKey: .reasonReference, in: _container, debugDescription: "More than one value provided for \"reason\"") + } + _t_reason = .reference(reasonReference) + } + self.reason = _t_reason + self.replaces = try [Reference](from: _container, forKeyIfPresent: .replaces) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action) + try author?.encode(on: &_container, forKey: .author) + try authoredOn?.encode(on: &_container, forKey: .authoredOn, auxiliaryKey: ._authoredOn) + try basedOn?.encode(on: &_container, forKey: .basedOn) + try context?.encode(on: &_container, forKey: .context) + try definition?.encode(on: &_container, forKey: .definition) + try groupIdentifier?.encode(on: &_container, forKey: .groupIdentifier) + try identifier?.encode(on: &_container, forKey: .identifier) + try intent.encode(on: &_container, forKey: .intent, auxiliaryKey: ._intent) + try note?.encode(on: &_container, forKey: .note) + try priority?.encode(on: &_container, forKey: .priority, auxiliaryKey: ._priority) + if let _enum = reason { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .reasonCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .reasonReference) + } + } + try replaces?.encode(on: &_container, forKey: .replaces) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? RequestGroup else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && author == _other.author + && authoredOn == _other.authoredOn + && basedOn == _other.basedOn + && context == _other.context + && definition == _other.definition + && groupIdentifier == _other.groupIdentifier + && identifier == _other.identifier + && intent == _other.intent + && note == _other.note + && priority == _other.priority + && reason == _other.reason + && replaces == _other.replaces + && status == _other.status + && subject == _other.subject + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(author) + hasher.combine(authoredOn) + hasher.combine(basedOn) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(groupIdentifier) + hasher.combine(identifier) + hasher.combine(intent) + hasher.combine(note) + hasher.combine(priority) + hasher.combine(reason) + hasher.combine(replaces) + hasher.combine(status) + hasher.combine(subject) + } +} + +/** + Proposed actions, if any. + + The actions, if any, produced by the evaluation of the artifact. + */ +open class RequestGroupAction: BackboneElement { + + /// All possible types for "timing[x]" + public enum TimingX: Hashable { + case dateTime(FHIRPrimitive) + case duration(Duration) + case period(Period) + case range(Range) + case timing(Timing) + } + + /// User-visible label for the action (e.g. 1. or A.) + public var label: FHIRPrimitive? + + /// User-visible title + public var title: FHIRPrimitive? + + /// Short description of the action + public var description_fhir: FHIRPrimitive? + + /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system + public var textEquivalent: FHIRPrimitive? + + /// Code representing the meaning of the action or sub-actions + public var code: [CodeableConcept]? + + /// Supporting documentation for the intended performer of the action + public var documentation: [RelatedArtifact]? + + /// Whether or not the action is applicable + public var condition: [RequestGroupActionCondition]? + + /// Relationship to another action + public var relatedAction: [RequestGroupActionRelatedAction]? + + /// When the action should take place + /// One of `timing[x]` + public var timing: TimingX? + + /// Who should perform the action + public var participant: [Reference]? + + /// create | update | remove | fire-event + public var type: Coding? + + /// Defines the grouping behavior for the action and its children. + public var groupingBehavior: FHIRPrimitive? + + /// Defines the selection behavior for the action and its children. + public var selectionBehavior: FHIRPrimitive? + + /// Defines the requiredness behavior for the action. + public var requiredBehavior: FHIRPrimitive? + + /// Defines whether the action should usually be preselected. + public var precheckBehavior: FHIRPrimitive? + + /// Defines whether the action can be selected multiple times. + public var cardinalityBehavior: FHIRPrimitive? + + /// The target of the action + public var resource: Reference? + + /// Sub action + public var action: [RequestGroupAction]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + action: [RequestGroupAction]? = nil, + cardinalityBehavior: FHIRPrimitive? = nil, + code: [CodeableConcept]? = nil, + condition: [RequestGroupActionCondition]? = nil, + description_fhir: FHIRPrimitive? = nil, + documentation: [RelatedArtifact]? = nil, + `extension`: [Extension]? = nil, + groupingBehavior: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + label: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + participant: [Reference]? = nil, + precheckBehavior: FHIRPrimitive? = nil, + relatedAction: [RequestGroupActionRelatedAction]? = nil, + requiredBehavior: FHIRPrimitive? = nil, + resource: Reference? = nil, + selectionBehavior: FHIRPrimitive? = nil, + textEquivalent: FHIRPrimitive? = nil, + timing: TimingX? = nil, + title: FHIRPrimitive? = nil, + type: Coding? = nil) + { + self.init() + self.action = action + self.cardinalityBehavior = cardinalityBehavior + self.code = code + self.condition = condition + self.description_fhir = description_fhir + self.documentation = documentation + self.`extension` = `extension` + self.groupingBehavior = groupingBehavior + self.id = id + self.label = label + self.modifierExtension = modifierExtension + self.participant = participant + self.precheckBehavior = precheckBehavior + self.relatedAction = relatedAction + self.requiredBehavior = requiredBehavior + self.resource = resource + self.selectionBehavior = selectionBehavior + self.textEquivalent = textEquivalent + self.timing = timing + self.title = title + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case cardinalityBehavior; case _cardinalityBehavior + case code + case condition + case description_fhir = "description"; case _description_fhir = "_description" + case documentation + case groupingBehavior; case _groupingBehavior + case label; case _label + case participant + case precheckBehavior; case _precheckBehavior + case relatedAction + case requiredBehavior; case _requiredBehavior + case resource + case selectionBehavior; case _selectionBehavior + case textEquivalent; case _textEquivalent + case timingDateTime; case _timingDateTime + case timingDuration + case timingPeriod + case timingRange + case timingTiming + case title; case _title + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [RequestGroupAction](from: _container, forKeyIfPresent: .action) + self.cardinalityBehavior = try FHIRPrimitive(from: _container, forKeyIfPresent: .cardinalityBehavior, auxiliaryKey: ._cardinalityBehavior) + self.code = try [CodeableConcept](from: _container, forKeyIfPresent: .code) + self.condition = try [RequestGroupActionCondition](from: _container, forKeyIfPresent: .condition) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.documentation = try [RelatedArtifact](from: _container, forKeyIfPresent: .documentation) + self.groupingBehavior = try FHIRPrimitive(from: _container, forKeyIfPresent: .groupingBehavior, auxiliaryKey: ._groupingBehavior) + self.label = try FHIRPrimitive(from: _container, forKeyIfPresent: .label, auxiliaryKey: ._label) + self.participant = try [Reference](from: _container, forKeyIfPresent: .participant) + self.precheckBehavior = try FHIRPrimitive(from: _container, forKeyIfPresent: .precheckBehavior, auxiliaryKey: ._precheckBehavior) + self.relatedAction = try [RequestGroupActionRelatedAction](from: _container, forKeyIfPresent: .relatedAction) + self.requiredBehavior = try FHIRPrimitive(from: _container, forKeyIfPresent: .requiredBehavior, auxiliaryKey: ._requiredBehavior) + self.resource = try Reference(from: _container, forKeyIfPresent: .resource) + self.selectionBehavior = try FHIRPrimitive(from: _container, forKeyIfPresent: .selectionBehavior, auxiliaryKey: ._selectionBehavior) + self.textEquivalent = try FHIRPrimitive(from: _container, forKeyIfPresent: .textEquivalent, auxiliaryKey: ._textEquivalent) + var _t_timing: TimingX? = nil + if let timingDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .timingDateTime, auxiliaryKey: ._timingDateTime) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingDateTime, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .dateTime(timingDateTime) + } + if let timingPeriod = try Period(from: _container, forKeyIfPresent: .timingPeriod) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingPeriod, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .period(timingPeriod) + } + if let timingDuration = try Duration(from: _container, forKeyIfPresent: .timingDuration) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingDuration, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .duration(timingDuration) + } + if let timingRange = try Range(from: _container, forKeyIfPresent: .timingRange) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingRange, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .range(timingRange) + } + if let timingTiming = try Timing(from: _container, forKeyIfPresent: .timingTiming) { + if _t_timing != nil { + throw DecodingError.dataCorruptedError(forKey: .timingTiming, in: _container, debugDescription: "More than one value provided for \"timing\"") + } + _t_timing = .timing(timingTiming) + } + self.timing = _t_timing + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.type = try Coding(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action?.encode(on: &_container, forKey: .action) + try cardinalityBehavior?.encode(on: &_container, forKey: .cardinalityBehavior, auxiliaryKey: ._cardinalityBehavior) + try code?.encode(on: &_container, forKey: .code) + try condition?.encode(on: &_container, forKey: .condition) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try documentation?.encode(on: &_container, forKey: .documentation) + try groupingBehavior?.encode(on: &_container, forKey: .groupingBehavior, auxiliaryKey: ._groupingBehavior) + try label?.encode(on: &_container, forKey: .label, auxiliaryKey: ._label) + try participant?.encode(on: &_container, forKey: .participant) + try precheckBehavior?.encode(on: &_container, forKey: .precheckBehavior, auxiliaryKey: ._precheckBehavior) + try relatedAction?.encode(on: &_container, forKey: .relatedAction) + try requiredBehavior?.encode(on: &_container, forKey: .requiredBehavior, auxiliaryKey: ._requiredBehavior) + try resource?.encode(on: &_container, forKey: .resource) + try selectionBehavior?.encode(on: &_container, forKey: .selectionBehavior, auxiliaryKey: ._selectionBehavior) + try textEquivalent?.encode(on: &_container, forKey: .textEquivalent, auxiliaryKey: ._textEquivalent) + if let _enum = timing { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .timingDateTime, auxiliaryKey: ._timingDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .timingPeriod) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .timingDuration) + case .range(let _value): + try _value.encode(on: &_container, forKey: .timingRange) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .timingTiming) + } + } + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? RequestGroupAction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && cardinalityBehavior == _other.cardinalityBehavior + && code == _other.code + && condition == _other.condition + && description_fhir == _other.description_fhir + && documentation == _other.documentation + && groupingBehavior == _other.groupingBehavior + && label == _other.label + && participant == _other.participant + && precheckBehavior == _other.precheckBehavior + && relatedAction == _other.relatedAction + && requiredBehavior == _other.requiredBehavior + && resource == _other.resource + && selectionBehavior == _other.selectionBehavior + && textEquivalent == _other.textEquivalent + && timing == _other.timing + && title == _other.title + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(cardinalityBehavior) + hasher.combine(code) + hasher.combine(condition) + hasher.combine(description_fhir) + hasher.combine(documentation) + hasher.combine(groupingBehavior) + hasher.combine(label) + hasher.combine(participant) + hasher.combine(precheckBehavior) + hasher.combine(relatedAction) + hasher.combine(requiredBehavior) + hasher.combine(resource) + hasher.combine(selectionBehavior) + hasher.combine(textEquivalent) + hasher.combine(timing) + hasher.combine(title) + hasher.combine(type) + } +} + +/** + Whether or not the action is applicable. + + An expression that describes applicability criteria, or start/stop conditions for the action. + */ +open class RequestGroupActionCondition: BackboneElement { + + /// The kind of condition. + public var kind: FHIRPrimitive + + /// Natural language description of the condition + public var description_fhir: FHIRPrimitive? + + /// Language of the expression + public var language: FHIRPrimitive? + + /// Boolean-valued expression + public var expression: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(kind: FHIRPrimitive) { + self.kind = kind + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + expression: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + kind: FHIRPrimitive, + language: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(kind: kind) + self.description_fhir = description_fhir + self.expression = expression + self.`extension` = `extension` + self.id = id + self.language = language + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case expression; case _expression + case kind; case _kind + case language; case _language + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.expression = try FHIRPrimitive(from: _container, forKeyIfPresent: .expression, auxiliaryKey: ._expression) + self.kind = try FHIRPrimitive(from: _container, forKey: .kind, auxiliaryKey: ._kind) + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try expression?.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try kind.encode(on: &_container, forKey: .kind, auxiliaryKey: ._kind) + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? RequestGroupActionCondition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && expression == _other.expression + && kind == _other.kind + && language == _other.language + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(expression) + hasher.combine(kind) + hasher.combine(language) + } +} + +/** + Relationship to another action. + + A relationship to another action such as "before" or "30-60 minutes after start of". + */ +open class RequestGroupActionRelatedAction: BackboneElement { + + /// All possible types for "offset[x]" + public enum OffsetX: Hashable { + case duration(Duration) + case range(Range) + } + + /// What action this is related to + public var actionId: FHIRPrimitive + + /// The relationship of this action to the related action. + public var relationship: FHIRPrimitive + + /// Time offset for the relationship + /// One of `offset[x]` + public var offset: OffsetX? + + /// Designated initializer taking all required properties + public init(actionId: FHIRPrimitive, relationship: FHIRPrimitive) { + self.actionId = actionId + self.relationship = relationship + super.init() + } + + /// Convenience initializer + public convenience init( + actionId: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + offset: OffsetX? = nil, + relationship: FHIRPrimitive) + { + self.init(actionId: actionId, relationship: relationship) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.offset = offset + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actionId; case _actionId + case offsetDuration + case offsetRange + case relationship; case _relationship + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actionId = try FHIRPrimitive(from: _container, forKey: .actionId, auxiliaryKey: ._actionId) + var _t_offset: OffsetX? = nil + if let offsetDuration = try Duration(from: _container, forKeyIfPresent: .offsetDuration) { + if _t_offset != nil { + throw DecodingError.dataCorruptedError(forKey: .offsetDuration, in: _container, debugDescription: "More than one value provided for \"offset\"") + } + _t_offset = .duration(offsetDuration) + } + if let offsetRange = try Range(from: _container, forKeyIfPresent: .offsetRange) { + if _t_offset != nil { + throw DecodingError.dataCorruptedError(forKey: .offsetRange, in: _container, debugDescription: "More than one value provided for \"offset\"") + } + _t_offset = .range(offsetRange) + } + self.offset = _t_offset + self.relationship = try FHIRPrimitive(from: _container, forKey: .relationship, auxiliaryKey: ._relationship) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actionId.encode(on: &_container, forKey: .actionId, auxiliaryKey: ._actionId) + if let _enum = offset { + switch _enum { + case .duration(let _value): + try _value.encode(on: &_container, forKey: .offsetDuration) + case .range(let _value): + try _value.encode(on: &_container, forKey: .offsetRange) + } + } + try relationship.encode(on: &_container, forKey: .relationship, auxiliaryKey: ._relationship) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? RequestGroupActionRelatedAction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actionId == _other.actionId + && offset == _other.offset + && relationship == _other.relationship + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actionId) + hasher.combine(offset) + hasher.combine(relationship) + } +} diff --git a/Sources/ModelsSTU3/ResearchStudy.swift b/Sources/ModelsSTU3/ResearchStudy.swift new file mode 100644 index 0000000..cddaaba --- /dev/null +++ b/Sources/ModelsSTU3/ResearchStudy.swift @@ -0,0 +1,388 @@ +// +// ResearchStudy.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ResearchStudy) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Investigation to increase healthcare-related patient-independent knowledge. + + A process where a researcher or organization plans and then executes a series of steps intended to increase the field + of healthcare-related knowledge. This includes studies of safety, efficacy, comparative effectiveness and other + information about medications, devices, therapies and other interventional and investigative techniques. A + ResearchStudy involves the gathering of information about human or animal subjects. + */ +open class ResearchStudy: DomainResource { + + override open class var resourceType: ResourceType { return .researchStudy } + + /// Business Identifier for study + public var identifier: [Identifier]? + + /// Name for this study + public var title: FHIRPrimitive? + + /// Steps followed in executing study + public var `protocol`: [Reference]? + + /// Part of larger study + public var partOf: [Reference]? + + /// The current state of the study. + public var status: FHIRPrimitive + + /// Classifications for the study + public var category: [CodeableConcept]? + + /// Drugs, devices, conditions, etc. under study + public var focus: [CodeableConcept]? + + /// Contact details for the study + public var contact: [ContactDetail]? + + /// References and dependencies + public var relatedArtifact: [RelatedArtifact]? + + /// Used to search for the study + public var keyword: [CodeableConcept]? + + /// Geographic region(s) for study + public var jurisdiction: [CodeableConcept]? + + /// What this is study doing + public var description_fhir: FHIRPrimitive? + + /// Inclusion & exclusion criteria + public var enrollment: [Reference]? + + /// When the study began and ended + public var period: Period? + + /// Organization responsible for the study + public var sponsor: Reference? + + /// The individual responsible for the study + public var principalInvestigator: Reference? + + /// Location involved in study execution + public var site: [Reference]? + + /// Reason for terminating study early + public var reasonStopped: CodeableConcept? + + /// Comments made about the event + public var note: [Annotation]? + + /// Defined path through the study for a subject + public var arm: [ResearchStudyArm]? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + arm: [ResearchStudyArm]? = nil, + category: [CodeableConcept]? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + description_fhir: FHIRPrimitive? = nil, + enrollment: [Reference]? = nil, + `extension`: [Extension]? = nil, + focus: [CodeableConcept]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + keyword: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + partOf: [Reference]? = nil, + period: Period? = nil, + principalInvestigator: Reference? = nil, + `protocol`: [Reference]? = nil, + reasonStopped: CodeableConcept? = nil, + relatedArtifact: [RelatedArtifact]? = nil, + site: [Reference]? = nil, + sponsor: Reference? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + title: FHIRPrimitive? = nil) + { + self.init(status: status) + self.arm = arm + self.category = category + self.contact = contact + self.contained = contained + self.description_fhir = description_fhir + self.enrollment = enrollment + self.`extension` = `extension` + self.focus = focus + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.keyword = keyword + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.partOf = partOf + self.period = period + self.principalInvestigator = principalInvestigator + self.`protocol` = `protocol` + self.reasonStopped = reasonStopped + self.relatedArtifact = relatedArtifact + self.site = site + self.sponsor = sponsor + self.text = text + self.title = title + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case arm + case category + case contact + case description_fhir = "description"; case _description_fhir = "_description" + case enrollment + case focus + case identifier + case jurisdiction + case keyword + case note + case partOf + case period + case principalInvestigator + case `protocol` = "protocol" + case reasonStopped + case relatedArtifact + case site + case sponsor + case status; case _status + case title; case _title + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.arm = try [ResearchStudyArm](from: _container, forKeyIfPresent: .arm) + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.enrollment = try [Reference](from: _container, forKeyIfPresent: .enrollment) + self.focus = try [CodeableConcept](from: _container, forKeyIfPresent: .focus) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.keyword = try [CodeableConcept](from: _container, forKeyIfPresent: .keyword) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.partOf = try [Reference](from: _container, forKeyIfPresent: .partOf) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.principalInvestigator = try Reference(from: _container, forKeyIfPresent: .principalInvestigator) + self.`protocol` = try [Reference](from: _container, forKeyIfPresent: .`protocol`) + self.reasonStopped = try CodeableConcept(from: _container, forKeyIfPresent: .reasonStopped) + self.relatedArtifact = try [RelatedArtifact](from: _container, forKeyIfPresent: .relatedArtifact) + self.site = try [Reference](from: _container, forKeyIfPresent: .site) + self.sponsor = try Reference(from: _container, forKeyIfPresent: .sponsor) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try arm?.encode(on: &_container, forKey: .arm) + try category?.encode(on: &_container, forKey: .category) + try contact?.encode(on: &_container, forKey: .contact) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try enrollment?.encode(on: &_container, forKey: .enrollment) + try focus?.encode(on: &_container, forKey: .focus) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try keyword?.encode(on: &_container, forKey: .keyword) + try note?.encode(on: &_container, forKey: .note) + try partOf?.encode(on: &_container, forKey: .partOf) + try period?.encode(on: &_container, forKey: .period) + try principalInvestigator?.encode(on: &_container, forKey: .principalInvestigator) + try `protocol`?.encode(on: &_container, forKey: .`protocol`) + try reasonStopped?.encode(on: &_container, forKey: .reasonStopped) + try relatedArtifact?.encode(on: &_container, forKey: .relatedArtifact) + try site?.encode(on: &_container, forKey: .site) + try sponsor?.encode(on: &_container, forKey: .sponsor) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ResearchStudy else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return arm == _other.arm + && category == _other.category + && contact == _other.contact + && description_fhir == _other.description_fhir + && enrollment == _other.enrollment + && focus == _other.focus + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && keyword == _other.keyword + && note == _other.note + && partOf == _other.partOf + && period == _other.period + && principalInvestigator == _other.principalInvestigator + && `protocol` == _other.`protocol` + && reasonStopped == _other.reasonStopped + && relatedArtifact == _other.relatedArtifact + && site == _other.site + && sponsor == _other.sponsor + && status == _other.status + && title == _other.title + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(arm) + hasher.combine(category) + hasher.combine(contact) + hasher.combine(description_fhir) + hasher.combine(enrollment) + hasher.combine(focus) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(keyword) + hasher.combine(note) + hasher.combine(partOf) + hasher.combine(period) + hasher.combine(principalInvestigator) + hasher.combine(`protocol`) + hasher.combine(reasonStopped) + hasher.combine(relatedArtifact) + hasher.combine(site) + hasher.combine(sponsor) + hasher.combine(status) + hasher.combine(title) + } +} + +/** + Defined path through the study for a subject. + + Describes an expected sequence of events for one of the participants of a study. E.g. Exposure to drug A, wash-out, + exposure to drug B, wash-out, follow-up. + */ +open class ResearchStudyArm: BackboneElement { + + /// Label for study arm + public var name: FHIRPrimitive + + /// Categorization of study arm + public var code: CodeableConcept? + + /// Short explanation of study path + public var description_fhir: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive) { + self.name = name + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive) + { + self.init(name: name) + self.code = code + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case description_fhir = "description"; case _description_fhir = "_description" + case name; case _name + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ResearchStudyArm else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && description_fhir == _other.description_fhir + && name == _other.name + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(description_fhir) + hasher.combine(name) + } +} diff --git a/Sources/ModelsSTU3/ResearchSubject.swift b/Sources/ModelsSTU3/ResearchSubject.swift new file mode 100644 index 0000000..22d0384 --- /dev/null +++ b/Sources/ModelsSTU3/ResearchSubject.swift @@ -0,0 +1,176 @@ +// +// ResearchSubject.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ResearchSubject) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Investigation to increase healthcare-related patient-independent knowledge. + + A process where a researcher or organization plans and then executes a series of steps intended to increase the field + of healthcare-related knowledge. This includes studies of safety, efficacy, comparative effectiveness and other + information about medications, devices, therapies and other interventional and investigative techniques. A + ResearchStudy involves the gathering of information about human or animal subjects. + */ +open class ResearchSubject: DomainResource { + + override open class var resourceType: ResourceType { return .researchSubject } + + /// Business Identifier for research subject + public var identifier: Identifier? + + /// The current state of the subject. + public var status: FHIRPrimitive + + /// Start and end of participation + public var period: Period? + + /// Study subject is part of + public var study: Reference + + /// Who is part of study + public var individual: Reference + + /// What path should be followed + public var assignedArm: FHIRPrimitive? + + /// What path was followed + public var actualArm: FHIRPrimitive? + + /// Agreement to participate in study + public var consent: Reference? + + /// Designated initializer taking all required properties + public init(individual: Reference, status: FHIRPrimitive, study: Reference) { + self.individual = individual + self.status = status + self.study = study + super.init() + } + + /// Convenience initializer + public convenience init( + actualArm: FHIRPrimitive? = nil, + assignedArm: FHIRPrimitive? = nil, + consent: Reference? = nil, + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + individual: Reference, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil, + status: FHIRPrimitive, + study: Reference, + text: Narrative? = nil) + { + self.init(individual: individual, status: status, study: study) + self.actualArm = actualArm + self.assignedArm = assignedArm + self.consent = consent + self.contained = contained + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.period = period + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case actualArm; case _actualArm + case assignedArm; case _assignedArm + case consent + case identifier + case individual + case period + case status; case _status + case study + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.actualArm = try FHIRPrimitive(from: _container, forKeyIfPresent: .actualArm, auxiliaryKey: ._actualArm) + self.assignedArm = try FHIRPrimitive(from: _container, forKeyIfPresent: .assignedArm, auxiliaryKey: ._assignedArm) + self.consent = try Reference(from: _container, forKeyIfPresent: .consent) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.individual = try Reference(from: _container, forKey: .individual) + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.study = try Reference(from: _container, forKey: .study) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try actualArm?.encode(on: &_container, forKey: .actualArm, auxiliaryKey: ._actualArm) + try assignedArm?.encode(on: &_container, forKey: .assignedArm, auxiliaryKey: ._assignedArm) + try consent?.encode(on: &_container, forKey: .consent) + try identifier?.encode(on: &_container, forKey: .identifier) + try individual.encode(on: &_container, forKey: .individual) + try period?.encode(on: &_container, forKey: .period) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try study.encode(on: &_container, forKey: .study) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ResearchSubject else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return actualArm == _other.actualArm + && assignedArm == _other.assignedArm + && consent == _other.consent + && identifier == _other.identifier + && individual == _other.individual + && period == _other.period + && status == _other.status + && study == _other.study + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(actualArm) + hasher.combine(assignedArm) + hasher.combine(consent) + hasher.combine(identifier) + hasher.combine(individual) + hasher.combine(period) + hasher.combine(status) + hasher.combine(study) + } +} diff --git a/Sources/ModelsSTU3/Resource.swift b/Sources/ModelsSTU3/Resource.swift new file mode 100644 index 0000000..0a187b6 --- /dev/null +++ b/Sources/ModelsSTU3/Resource.swift @@ -0,0 +1,117 @@ +// +// Resource.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Resource) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Base Resource. + + This is the base resource type for everything. + */ +open class Resource: FHIRAbstractResource { + + override open class var resourceType: ResourceType { return .resource } + + /// Logical id of this artifact + public var id: FHIRPrimitive? + + /// Metadata about the resource + public var meta: Meta? + + /// A set of rules under which this content was created + public var implicitRules: FHIRPrimitive? + + /// Language of the resource content + public var language: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil) + { + self.init() + self.id = id + self.implicitRules = implicitRules + self.language = language + self.meta = meta + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case id; case _id + case implicitRules; case _implicitRules + case language; case _language + case meta + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.id = try FHIRPrimitive(from: _container, forKeyIfPresent: .id, auxiliaryKey: ._id) + self.implicitRules = try FHIRPrimitive(from: _container, forKeyIfPresent: .implicitRules, auxiliaryKey: ._implicitRules) + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + self.meta = try Meta(from: _container, forKeyIfPresent: .meta) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try id?.encode(on: &_container, forKey: .id, auxiliaryKey: ._id) + try implicitRules?.encode(on: &_container, forKey: .implicitRules, auxiliaryKey: ._implicitRules) + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try meta?.encode(on: &_container, forKey: .meta) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Resource else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return id == _other.id + && implicitRules == _other.implicitRules + && language == _other.language + && meta == _other.meta + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(id) + hasher.combine(implicitRules) + hasher.combine(language) + hasher.combine(meta) + } +} diff --git a/Sources/ModelsSTU3/ResourceProxy.swift b/Sources/ModelsSTU3/ResourceProxy.swift new file mode 100644 index 0000000..70d71f6 --- /dev/null +++ b/Sources/ModelsSTU3/ResourceProxy.swift @@ -0,0 +1,897 @@ +// +// ResourceProxy.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +public enum ResourceProxy: FHIRType { + case account(Account) + case activityDefinition(ActivityDefinition) + case adverseEvent(AdverseEvent) + case allergyIntolerance(AllergyIntolerance) + case appointment(Appointment) + case appointmentResponse(AppointmentResponse) + case auditEvent(AuditEvent) + case basic(Basic) + case binary(Binary) + case bodySite(BodySite) + case bundle(Bundle) + case capabilityStatement(CapabilityStatement) + case carePlan(CarePlan) + case careTeam(CareTeam) + case chargeItem(ChargeItem) + case claim(Claim) + case claimResponse(ClaimResponse) + case clinicalImpression(ClinicalImpression) + case codeSystem(CodeSystem) + case communication(Communication) + case communicationRequest(CommunicationRequest) + case compartmentDefinition(CompartmentDefinition) + case composition(Composition) + case conceptMap(ConceptMap) + case condition(Condition) + case consent(Consent) + case contract(Contract) + case coverage(Coverage) + case dataElement(DataElement) + case detectedIssue(DetectedIssue) + case device(Device) + case deviceComponent(DeviceComponent) + case deviceMetric(DeviceMetric) + case deviceRequest(DeviceRequest) + case deviceUseStatement(DeviceUseStatement) + case diagnosticReport(DiagnosticReport) + case documentManifest(DocumentManifest) + case documentReference(DocumentReference) + case domainResource(DomainResource) + case eligibilityRequest(EligibilityRequest) + case eligibilityResponse(EligibilityResponse) + case encounter(Encounter) + case endpoint(Endpoint) + case enrollmentRequest(EnrollmentRequest) + case enrollmentResponse(EnrollmentResponse) + case episodeOfCare(EpisodeOfCare) + case expansionProfile(ExpansionProfile) + case explanationOfBenefit(ExplanationOfBenefit) + case familyMemberHistory(FamilyMemberHistory) + case flag(Flag) + case goal(Goal) + case graphDefinition(GraphDefinition) + case group(Group) + case guidanceResponse(GuidanceResponse) + case healthcareService(HealthcareService) + case imagingManifest(ImagingManifest) + case imagingStudy(ImagingStudy) + case immunization(Immunization) + case immunizationRecommendation(ImmunizationRecommendation) + case implementationGuide(ImplementationGuide) + case library(Library) + case linkage(Linkage) + case list(List) + case location(Location) + case measure(Measure) + case measureReport(MeasureReport) + case media(Media) + case medication(Medication) + case medicationAdministration(MedicationAdministration) + case medicationDispense(MedicationDispense) + case medicationRequest(MedicationRequest) + case medicationStatement(MedicationStatement) + case messageDefinition(MessageDefinition) + case messageHeader(MessageHeader) + case namingSystem(NamingSystem) + case nutritionOrder(NutritionOrder) + case observation(Observation) + case operationDefinition(OperationDefinition) + case operationOutcome(OperationOutcome) + case organization(Organization) + case parameters(Parameters) + case patient(Patient) + case paymentNotice(PaymentNotice) + case paymentReconciliation(PaymentReconciliation) + case person(Person) + case planDefinition(PlanDefinition) + case practitioner(Practitioner) + case practitionerRole(PractitionerRole) + case procedure(Procedure) + case procedureRequest(ProcedureRequest) + case processRequest(ProcessRequest) + case processResponse(ProcessResponse) + case provenance(Provenance) + case questionnaire(Questionnaire) + case questionnaireResponse(QuestionnaireResponse) + case referralRequest(ReferralRequest) + case relatedPerson(RelatedPerson) + case requestGroup(RequestGroup) + case researchStudy(ResearchStudy) + case researchSubject(ResearchSubject) + case resource(Resource) + case riskAssessment(RiskAssessment) + case schedule(Schedule) + case searchParameter(SearchParameter) + case sequence(Sequence) + case serviceDefinition(ServiceDefinition) + case slot(Slot) + case specimen(Specimen) + case structureDefinition(StructureDefinition) + case structureMap(StructureMap) + case subscription(Subscription) + case substance(Substance) + case supplyDelivery(SupplyDelivery) + case supplyRequest(SupplyRequest) + case task(Task) + case testReport(TestReport) + case testScript(TestScript) + case valueSet(ValueSet) + case visionPrescription(VisionPrescription) + case unrecognized(Resource) + + // MARK: - + + public init(with resource: Resource) { + switch type(of: resource).resourceType { + case .account: + self = .account(resource as! Account) + case .activityDefinition: + self = .activityDefinition(resource as! ActivityDefinition) + case .adverseEvent: + self = .adverseEvent(resource as! AdverseEvent) + case .allergyIntolerance: + self = .allergyIntolerance(resource as! AllergyIntolerance) + case .appointment: + self = .appointment(resource as! Appointment) + case .appointmentResponse: + self = .appointmentResponse(resource as! AppointmentResponse) + case .auditEvent: + self = .auditEvent(resource as! AuditEvent) + case .basic: + self = .basic(resource as! Basic) + case .binary: + self = .binary(resource as! Binary) + case .bodySite: + self = .bodySite(resource as! BodySite) + case .bundle: + self = .bundle(resource as! Bundle) + case .capabilityStatement: + self = .capabilityStatement(resource as! CapabilityStatement) + case .carePlan: + self = .carePlan(resource as! CarePlan) + case .careTeam: + self = .careTeam(resource as! CareTeam) + case .chargeItem: + self = .chargeItem(resource as! ChargeItem) + case .claim: + self = .claim(resource as! Claim) + case .claimResponse: + self = .claimResponse(resource as! ClaimResponse) + case .clinicalImpression: + self = .clinicalImpression(resource as! ClinicalImpression) + case .codeSystem: + self = .codeSystem(resource as! CodeSystem) + case .communication: + self = .communication(resource as! Communication) + case .communicationRequest: + self = .communicationRequest(resource as! CommunicationRequest) + case .compartmentDefinition: + self = .compartmentDefinition(resource as! CompartmentDefinition) + case .composition: + self = .composition(resource as! Composition) + case .conceptMap: + self = .conceptMap(resource as! ConceptMap) + case .condition: + self = .condition(resource as! Condition) + case .consent: + self = .consent(resource as! Consent) + case .contract: + self = .contract(resource as! Contract) + case .coverage: + self = .coverage(resource as! Coverage) + case .dataElement: + self = .dataElement(resource as! DataElement) + case .detectedIssue: + self = .detectedIssue(resource as! DetectedIssue) + case .device: + self = .device(resource as! Device) + case .deviceComponent: + self = .deviceComponent(resource as! DeviceComponent) + case .deviceMetric: + self = .deviceMetric(resource as! DeviceMetric) + case .deviceRequest: + self = .deviceRequest(resource as! DeviceRequest) + case .deviceUseStatement: + self = .deviceUseStatement(resource as! DeviceUseStatement) + case .diagnosticReport: + self = .diagnosticReport(resource as! DiagnosticReport) + case .documentManifest: + self = .documentManifest(resource as! DocumentManifest) + case .documentReference: + self = .documentReference(resource as! DocumentReference) + case .domainResource: + self = .domainResource(resource as! DomainResource) + case .eligibilityRequest: + self = .eligibilityRequest(resource as! EligibilityRequest) + case .eligibilityResponse: + self = .eligibilityResponse(resource as! EligibilityResponse) + case .encounter: + self = .encounter(resource as! Encounter) + case .endpoint: + self = .endpoint(resource as! Endpoint) + case .enrollmentRequest: + self = .enrollmentRequest(resource as! EnrollmentRequest) + case .enrollmentResponse: + self = .enrollmentResponse(resource as! EnrollmentResponse) + case .episodeOfCare: + self = .episodeOfCare(resource as! EpisodeOfCare) + case .expansionProfile: + self = .expansionProfile(resource as! ExpansionProfile) + case .explanationOfBenefit: + self = .explanationOfBenefit(resource as! ExplanationOfBenefit) + case .familyMemberHistory: + self = .familyMemberHistory(resource as! FamilyMemberHistory) + case .flag: + self = .flag(resource as! Flag) + case .goal: + self = .goal(resource as! Goal) + case .graphDefinition: + self = .graphDefinition(resource as! GraphDefinition) + case .group: + self = .group(resource as! Group) + case .guidanceResponse: + self = .guidanceResponse(resource as! GuidanceResponse) + case .healthcareService: + self = .healthcareService(resource as! HealthcareService) + case .imagingManifest: + self = .imagingManifest(resource as! ImagingManifest) + case .imagingStudy: + self = .imagingStudy(resource as! ImagingStudy) + case .immunization: + self = .immunization(resource as! Immunization) + case .immunizationRecommendation: + self = .immunizationRecommendation(resource as! ImmunizationRecommendation) + case .implementationGuide: + self = .implementationGuide(resource as! ImplementationGuide) + case .library: + self = .library(resource as! Library) + case .linkage: + self = .linkage(resource as! Linkage) + case .list: + self = .list(resource as! List) + case .location: + self = .location(resource as! Location) + case .measure: + self = .measure(resource as! Measure) + case .measureReport: + self = .measureReport(resource as! MeasureReport) + case .media: + self = .media(resource as! Media) + case .medication: + self = .medication(resource as! Medication) + case .medicationAdministration: + self = .medicationAdministration(resource as! MedicationAdministration) + case .medicationDispense: + self = .medicationDispense(resource as! MedicationDispense) + case .medicationRequest: + self = .medicationRequest(resource as! MedicationRequest) + case .medicationStatement: + self = .medicationStatement(resource as! MedicationStatement) + case .messageDefinition: + self = .messageDefinition(resource as! MessageDefinition) + case .messageHeader: + self = .messageHeader(resource as! MessageHeader) + case .namingSystem: + self = .namingSystem(resource as! NamingSystem) + case .nutritionOrder: + self = .nutritionOrder(resource as! NutritionOrder) + case .observation: + self = .observation(resource as! Observation) + case .operationDefinition: + self = .operationDefinition(resource as! OperationDefinition) + case .operationOutcome: + self = .operationOutcome(resource as! OperationOutcome) + case .organization: + self = .organization(resource as! Organization) + case .parameters: + self = .parameters(resource as! Parameters) + case .patient: + self = .patient(resource as! Patient) + case .paymentNotice: + self = .paymentNotice(resource as! PaymentNotice) + case .paymentReconciliation: + self = .paymentReconciliation(resource as! PaymentReconciliation) + case .person: + self = .person(resource as! Person) + case .planDefinition: + self = .planDefinition(resource as! PlanDefinition) + case .practitioner: + self = .practitioner(resource as! Practitioner) + case .practitionerRole: + self = .practitionerRole(resource as! PractitionerRole) + case .procedure: + self = .procedure(resource as! Procedure) + case .procedureRequest: + self = .procedureRequest(resource as! ProcedureRequest) + case .processRequest: + self = .processRequest(resource as! ProcessRequest) + case .processResponse: + self = .processResponse(resource as! ProcessResponse) + case .provenance: + self = .provenance(resource as! Provenance) + case .questionnaire: + self = .questionnaire(resource as! Questionnaire) + case .questionnaireResponse: + self = .questionnaireResponse(resource as! QuestionnaireResponse) + case .referralRequest: + self = .referralRequest(resource as! ReferralRequest) + case .relatedPerson: + self = .relatedPerson(resource as! RelatedPerson) + case .requestGroup: + self = .requestGroup(resource as! RequestGroup) + case .researchStudy: + self = .researchStudy(resource as! ResearchStudy) + case .researchSubject: + self = .researchSubject(resource as! ResearchSubject) + case .resource: + self = .resource(resource) + case .riskAssessment: + self = .riskAssessment(resource as! RiskAssessment) + case .schedule: + self = .schedule(resource as! Schedule) + case .searchParameter: + self = .searchParameter(resource as! SearchParameter) + case .sequence: + self = .sequence(resource as! Sequence) + case .serviceDefinition: + self = .serviceDefinition(resource as! ServiceDefinition) + case .slot: + self = .slot(resource as! Slot) + case .specimen: + self = .specimen(resource as! Specimen) + case .structureDefinition: + self = .structureDefinition(resource as! StructureDefinition) + case .structureMap: + self = .structureMap(resource as! StructureMap) + case .subscription: + self = .subscription(resource as! Subscription) + case .substance: + self = .substance(resource as! Substance) + case .supplyDelivery: + self = .supplyDelivery(resource as! SupplyDelivery) + case .supplyRequest: + self = .supplyRequest(resource as! SupplyRequest) + case .task: + self = .task(resource as! Task) + case .testReport: + self = .testReport(resource as! TestReport) + case .testScript: + self = .testScript(resource as! TestScript) + case .valueSet: + self = .valueSet(resource as! ValueSet) + case .visionPrescription: + self = .visionPrescription(resource as! VisionPrescription) + } + } + + public func get() -> Resource { + switch self { + case .account(let resource): + return resource + case .activityDefinition(let resource): + return resource + case .adverseEvent(let resource): + return resource + case .allergyIntolerance(let resource): + return resource + case .appointment(let resource): + return resource + case .appointmentResponse(let resource): + return resource + case .auditEvent(let resource): + return resource + case .basic(let resource): + return resource + case .binary(let resource): + return resource + case .bodySite(let resource): + return resource + case .bundle(let resource): + return resource + case .capabilityStatement(let resource): + return resource + case .carePlan(let resource): + return resource + case .careTeam(let resource): + return resource + case .chargeItem(let resource): + return resource + case .claim(let resource): + return resource + case .claimResponse(let resource): + return resource + case .clinicalImpression(let resource): + return resource + case .codeSystem(let resource): + return resource + case .communication(let resource): + return resource + case .communicationRequest(let resource): + return resource + case .compartmentDefinition(let resource): + return resource + case .composition(let resource): + return resource + case .conceptMap(let resource): + return resource + case .condition(let resource): + return resource + case .consent(let resource): + return resource + case .contract(let resource): + return resource + case .coverage(let resource): + return resource + case .dataElement(let resource): + return resource + case .detectedIssue(let resource): + return resource + case .device(let resource): + return resource + case .deviceComponent(let resource): + return resource + case .deviceMetric(let resource): + return resource + case .deviceRequest(let resource): + return resource + case .deviceUseStatement(let resource): + return resource + case .diagnosticReport(let resource): + return resource + case .documentManifest(let resource): + return resource + case .documentReference(let resource): + return resource + case .domainResource(let resource): + return resource + case .eligibilityRequest(let resource): + return resource + case .eligibilityResponse(let resource): + return resource + case .encounter(let resource): + return resource + case .endpoint(let resource): + return resource + case .enrollmentRequest(let resource): + return resource + case .enrollmentResponse(let resource): + return resource + case .episodeOfCare(let resource): + return resource + case .expansionProfile(let resource): + return resource + case .explanationOfBenefit(let resource): + return resource + case .familyMemberHistory(let resource): + return resource + case .flag(let resource): + return resource + case .goal(let resource): + return resource + case .graphDefinition(let resource): + return resource + case .group(let resource): + return resource + case .guidanceResponse(let resource): + return resource + case .healthcareService(let resource): + return resource + case .imagingManifest(let resource): + return resource + case .imagingStudy(let resource): + return resource + case .immunization(let resource): + return resource + case .immunizationRecommendation(let resource): + return resource + case .implementationGuide(let resource): + return resource + case .library(let resource): + return resource + case .linkage(let resource): + return resource + case .list(let resource): + return resource + case .location(let resource): + return resource + case .measure(let resource): + return resource + case .measureReport(let resource): + return resource + case .media(let resource): + return resource + case .medication(let resource): + return resource + case .medicationAdministration(let resource): + return resource + case .medicationDispense(let resource): + return resource + case .medicationRequest(let resource): + return resource + case .medicationStatement(let resource): + return resource + case .messageDefinition(let resource): + return resource + case .messageHeader(let resource): + return resource + case .namingSystem(let resource): + return resource + case .nutritionOrder(let resource): + return resource + case .observation(let resource): + return resource + case .operationDefinition(let resource): + return resource + case .operationOutcome(let resource): + return resource + case .organization(let resource): + return resource + case .parameters(let resource): + return resource + case .patient(let resource): + return resource + case .paymentNotice(let resource): + return resource + case .paymentReconciliation(let resource): + return resource + case .person(let resource): + return resource + case .planDefinition(let resource): + return resource + case .practitioner(let resource): + return resource + case .practitionerRole(let resource): + return resource + case .procedure(let resource): + return resource + case .procedureRequest(let resource): + return resource + case .processRequest(let resource): + return resource + case .processResponse(let resource): + return resource + case .provenance(let resource): + return resource + case .questionnaire(let resource): + return resource + case .questionnaireResponse(let resource): + return resource + case .referralRequest(let resource): + return resource + case .relatedPerson(let resource): + return resource + case .requestGroup(let resource): + return resource + case .researchStudy(let resource): + return resource + case .researchSubject(let resource): + return resource + case .resource(let resource): + return resource + case .riskAssessment(let resource): + return resource + case .schedule(let resource): + return resource + case .searchParameter(let resource): + return resource + case .sequence(let resource): + return resource + case .serviceDefinition(let resource): + return resource + case .slot(let resource): + return resource + case .specimen(let resource): + return resource + case .structureDefinition(let resource): + return resource + case .structureMap(let resource): + return resource + case .subscription(let resource): + return resource + case .substance(let resource): + return resource + case .supplyDelivery(let resource): + return resource + case .supplyRequest(let resource): + return resource + case .task(let resource): + return resource + case .testReport(let resource): + return resource + case .testScript(let resource): + return resource + case .valueSet(let resource): + return resource + case .visionPrescription(let resource): + return resource + case .unrecognized(let resource): + return resource + } + } + + public func get(if type: T.Type) -> T? { + guard let resource = get() as? T else { + return nil + } + return resource + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case resourceType + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + + switch try container.decode(String.self, forKey: .resourceType) { + case "Account": + self = .account(try Account(from: decoder)) + case "ActivityDefinition": + self = .activityDefinition(try ActivityDefinition(from: decoder)) + case "AdverseEvent": + self = .adverseEvent(try AdverseEvent(from: decoder)) + case "AllergyIntolerance": + self = .allergyIntolerance(try AllergyIntolerance(from: decoder)) + case "Appointment": + self = .appointment(try Appointment(from: decoder)) + case "AppointmentResponse": + self = .appointmentResponse(try AppointmentResponse(from: decoder)) + case "AuditEvent": + self = .auditEvent(try AuditEvent(from: decoder)) + case "Basic": + self = .basic(try Basic(from: decoder)) + case "Binary": + self = .binary(try Binary(from: decoder)) + case "BodySite": + self = .bodySite(try BodySite(from: decoder)) + case "Bundle": + self = .bundle(try Bundle(from: decoder)) + case "CapabilityStatement": + self = .capabilityStatement(try CapabilityStatement(from: decoder)) + case "CarePlan": + self = .carePlan(try CarePlan(from: decoder)) + case "CareTeam": + self = .careTeam(try CareTeam(from: decoder)) + case "ChargeItem": + self = .chargeItem(try ChargeItem(from: decoder)) + case "Claim": + self = .claim(try Claim(from: decoder)) + case "ClaimResponse": + self = .claimResponse(try ClaimResponse(from: decoder)) + case "ClinicalImpression": + self = .clinicalImpression(try ClinicalImpression(from: decoder)) + case "CodeSystem": + self = .codeSystem(try CodeSystem(from: decoder)) + case "Communication": + self = .communication(try Communication(from: decoder)) + case "CommunicationRequest": + self = .communicationRequest(try CommunicationRequest(from: decoder)) + case "CompartmentDefinition": + self = .compartmentDefinition(try CompartmentDefinition(from: decoder)) + case "Composition": + self = .composition(try Composition(from: decoder)) + case "ConceptMap": + self = .conceptMap(try ConceptMap(from: decoder)) + case "Condition": + self = .condition(try Condition(from: decoder)) + case "Consent": + self = .consent(try Consent(from: decoder)) + case "Contract": + self = .contract(try Contract(from: decoder)) + case "Coverage": + self = .coverage(try Coverage(from: decoder)) + case "DataElement": + self = .dataElement(try DataElement(from: decoder)) + case "DetectedIssue": + self = .detectedIssue(try DetectedIssue(from: decoder)) + case "Device": + self = .device(try Device(from: decoder)) + case "DeviceComponent": + self = .deviceComponent(try DeviceComponent(from: decoder)) + case "DeviceMetric": + self = .deviceMetric(try DeviceMetric(from: decoder)) + case "DeviceRequest": + self = .deviceRequest(try DeviceRequest(from: decoder)) + case "DeviceUseStatement": + self = .deviceUseStatement(try DeviceUseStatement(from: decoder)) + case "DiagnosticReport": + self = .diagnosticReport(try DiagnosticReport(from: decoder)) + case "DocumentManifest": + self = .documentManifest(try DocumentManifest(from: decoder)) + case "DocumentReference": + self = .documentReference(try DocumentReference(from: decoder)) + case "DomainResource": + self = .domainResource(try DomainResource(from: decoder)) + case "EligibilityRequest": + self = .eligibilityRequest(try EligibilityRequest(from: decoder)) + case "EligibilityResponse": + self = .eligibilityResponse(try EligibilityResponse(from: decoder)) + case "Encounter": + self = .encounter(try Encounter(from: decoder)) + case "Endpoint": + self = .endpoint(try Endpoint(from: decoder)) + case "EnrollmentRequest": + self = .enrollmentRequest(try EnrollmentRequest(from: decoder)) + case "EnrollmentResponse": + self = .enrollmentResponse(try EnrollmentResponse(from: decoder)) + case "EpisodeOfCare": + self = .episodeOfCare(try EpisodeOfCare(from: decoder)) + case "ExpansionProfile": + self = .expansionProfile(try ExpansionProfile(from: decoder)) + case "ExplanationOfBenefit": + self = .explanationOfBenefit(try ExplanationOfBenefit(from: decoder)) + case "FamilyMemberHistory": + self = .familyMemberHistory(try FamilyMemberHistory(from: decoder)) + case "Flag": + self = .flag(try Flag(from: decoder)) + case "Goal": + self = .goal(try Goal(from: decoder)) + case "GraphDefinition": + self = .graphDefinition(try GraphDefinition(from: decoder)) + case "Group": + self = .group(try Group(from: decoder)) + case "GuidanceResponse": + self = .guidanceResponse(try GuidanceResponse(from: decoder)) + case "HealthcareService": + self = .healthcareService(try HealthcareService(from: decoder)) + case "ImagingManifest": + self = .imagingManifest(try ImagingManifest(from: decoder)) + case "ImagingStudy": + self = .imagingStudy(try ImagingStudy(from: decoder)) + case "Immunization": + self = .immunization(try Immunization(from: decoder)) + case "ImmunizationRecommendation": + self = .immunizationRecommendation(try ImmunizationRecommendation(from: decoder)) + case "ImplementationGuide": + self = .implementationGuide(try ImplementationGuide(from: decoder)) + case "Library": + self = .library(try Library(from: decoder)) + case "Linkage": + self = .linkage(try Linkage(from: decoder)) + case "List": + self = .list(try List(from: decoder)) + case "Location": + self = .location(try Location(from: decoder)) + case "Measure": + self = .measure(try Measure(from: decoder)) + case "MeasureReport": + self = .measureReport(try MeasureReport(from: decoder)) + case "Media": + self = .media(try Media(from: decoder)) + case "Medication": + self = .medication(try Medication(from: decoder)) + case "MedicationAdministration": + self = .medicationAdministration(try MedicationAdministration(from: decoder)) + case "MedicationDispense": + self = .medicationDispense(try MedicationDispense(from: decoder)) + case "MedicationRequest": + self = .medicationRequest(try MedicationRequest(from: decoder)) + case "MedicationStatement": + self = .medicationStatement(try MedicationStatement(from: decoder)) + case "MessageDefinition": + self = .messageDefinition(try MessageDefinition(from: decoder)) + case "MessageHeader": + self = .messageHeader(try MessageHeader(from: decoder)) + case "NamingSystem": + self = .namingSystem(try NamingSystem(from: decoder)) + case "NutritionOrder": + self = .nutritionOrder(try NutritionOrder(from: decoder)) + case "Observation": + self = .observation(try Observation(from: decoder)) + case "OperationDefinition": + self = .operationDefinition(try OperationDefinition(from: decoder)) + case "OperationOutcome": + self = .operationOutcome(try OperationOutcome(from: decoder)) + case "Organization": + self = .organization(try Organization(from: decoder)) + case "Parameters": + self = .parameters(try Parameters(from: decoder)) + case "Patient": + self = .patient(try Patient(from: decoder)) + case "PaymentNotice": + self = .paymentNotice(try PaymentNotice(from: decoder)) + case "PaymentReconciliation": + self = .paymentReconciliation(try PaymentReconciliation(from: decoder)) + case "Person": + self = .person(try Person(from: decoder)) + case "PlanDefinition": + self = .planDefinition(try PlanDefinition(from: decoder)) + case "Practitioner": + self = .practitioner(try Practitioner(from: decoder)) + case "PractitionerRole": + self = .practitionerRole(try PractitionerRole(from: decoder)) + case "Procedure": + self = .procedure(try Procedure(from: decoder)) + case "ProcedureRequest": + self = .procedureRequest(try ProcedureRequest(from: decoder)) + case "ProcessRequest": + self = .processRequest(try ProcessRequest(from: decoder)) + case "ProcessResponse": + self = .processResponse(try ProcessResponse(from: decoder)) + case "Provenance": + self = .provenance(try Provenance(from: decoder)) + case "Questionnaire": + self = .questionnaire(try Questionnaire(from: decoder)) + case "QuestionnaireResponse": + self = .questionnaireResponse(try QuestionnaireResponse(from: decoder)) + case "ReferralRequest": + self = .referralRequest(try ReferralRequest(from: decoder)) + case "RelatedPerson": + self = .relatedPerson(try RelatedPerson(from: decoder)) + case "RequestGroup": + self = .requestGroup(try RequestGroup(from: decoder)) + case "ResearchStudy": + self = .researchStudy(try ResearchStudy(from: decoder)) + case "ResearchSubject": + self = .researchSubject(try ResearchSubject(from: decoder)) + case "Resource": + self = .resource(try Resource(from: decoder)) + case "RiskAssessment": + self = .riskAssessment(try RiskAssessment(from: decoder)) + case "Schedule": + self = .schedule(try Schedule(from: decoder)) + case "SearchParameter": + self = .searchParameter(try SearchParameter(from: decoder)) + case "Sequence": + self = .sequence(try Sequence(from: decoder)) + case "ServiceDefinition": + self = .serviceDefinition(try ServiceDefinition(from: decoder)) + case "Slot": + self = .slot(try Slot(from: decoder)) + case "Specimen": + self = .specimen(try Specimen(from: decoder)) + case "StructureDefinition": + self = .structureDefinition(try StructureDefinition(from: decoder)) + case "StructureMap": + self = .structureMap(try StructureMap(from: decoder)) + case "Subscription": + self = .subscription(try Subscription(from: decoder)) + case "Substance": + self = .substance(try Substance(from: decoder)) + case "SupplyDelivery": + self = .supplyDelivery(try SupplyDelivery(from: decoder)) + case "SupplyRequest": + self = .supplyRequest(try SupplyRequest(from: decoder)) + case "Task": + self = .task(try Task(from: decoder)) + case "TestReport": + self = .testReport(try TestReport(from: decoder)) + case "TestScript": + self = .testScript(try TestScript(from: decoder)) + case "ValueSet": + self = .valueSet(try ValueSet(from: decoder)) + case "VisionPrescription": + self = .visionPrescription(try VisionPrescription(from: decoder)) + default: + self = .unrecognized(try Resource(from: decoder)) + } + } + + public func encode(to encoder: Encoder) throws { + try get().encode(to: encoder) + } +} \ No newline at end of file diff --git a/Sources/ModelsSTU3/RiskAssessment.swift b/Sources/ModelsSTU3/RiskAssessment.swift new file mode 100644 index 0000000..c0a7a64 --- /dev/null +++ b/Sources/ModelsSTU3/RiskAssessment.swift @@ -0,0 +1,486 @@ +// +// RiskAssessment.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/RiskAssessment) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Potential outcomes for a subject with likelihood. + + An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome. + */ +open class RiskAssessment: DomainResource { + + override open class var resourceType: ResourceType { return .riskAssessment } + + /// All possible types for "occurrence[x]" + public enum OccurrenceX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// All possible types for "reason[x]" + public enum ReasonX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Unique identifier for the assessment + public var identifier: Identifier? + + /// Request fulfilled by this assessment + public var basedOn: Reference? + + /// Part of this occurrence + public var parent: Reference? + + /// The status of the RiskAssessment, using the same statuses as an Observation. + public var status: FHIRPrimitive + + /// Evaluation mechanism + public var method: CodeableConcept? + + /// Type of assessment + public var code: CodeableConcept? + + /// Who/what does assessment apply to? + public var subject: Reference? + + /// Where was assessment performed? + public var context: Reference? + + /// When was assessment made? + /// One of `occurrence[x]` + public var occurrence: OccurrenceX? + + /// Condition assessed + public var condition: Reference? + + /// Who did assessment? + public var performer: Reference? + + /// Why the assessment was necessary? + /// One of `reason[x]` + public var reason: ReasonX? + + /// Information used in assessment + public var basis: [Reference]? + + /// Outcome predicted + public var prediction: [RiskAssessmentPrediction]? + + /// How to reduce risk + public var mitigation: FHIRPrimitive? + + /// Comments on the risk assessment + public var comment: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + basedOn: Reference? = nil, + basis: [Reference]? = nil, + code: CodeableConcept? = nil, + comment: FHIRPrimitive? = nil, + condition: Reference? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + method: CodeableConcept? = nil, + mitigation: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + occurrence: OccurrenceX? = nil, + parent: Reference? = nil, + performer: Reference? = nil, + prediction: [RiskAssessmentPrediction]? = nil, + reason: ReasonX? = nil, + status: FHIRPrimitive, + subject: Reference? = nil, + text: Narrative? = nil) + { + self.init(status: status) + self.basedOn = basedOn + self.basis = basis + self.code = code + self.comment = comment + self.condition = condition + self.contained = contained + self.context = context + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.method = method + self.mitigation = mitigation + self.modifierExtension = modifierExtension + self.occurrence = occurrence + self.parent = parent + self.performer = performer + self.prediction = prediction + self.reason = reason + self.subject = subject + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case basedOn + case basis + case code + case comment; case _comment + case condition + case context + case identifier + case method + case mitigation; case _mitigation + case occurrenceDateTime; case _occurrenceDateTime + case occurrencePeriod + case parent + case performer + case prediction + case reasonCodeableConcept + case reasonReference + case status; case _status + case subject + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.basedOn = try Reference(from: _container, forKeyIfPresent: .basedOn) + self.basis = try [Reference](from: _container, forKeyIfPresent: .basis) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.condition = try Reference(from: _container, forKeyIfPresent: .condition) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.method = try CodeableConcept(from: _container, forKeyIfPresent: .method) + self.mitigation = try FHIRPrimitive(from: _container, forKeyIfPresent: .mitigation, auxiliaryKey: ._mitigation) + var _t_occurrence: OccurrenceX? = nil + if let occurrenceDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceDateTime, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .dateTime(occurrenceDateTime) + } + if let occurrencePeriod = try Period(from: _container, forKeyIfPresent: .occurrencePeriod) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrencePeriod, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .period(occurrencePeriod) + } + self.occurrence = _t_occurrence + self.parent = try Reference(from: _container, forKeyIfPresent: .parent) + self.performer = try Reference(from: _container, forKeyIfPresent: .performer) + self.prediction = try [RiskAssessmentPrediction](from: _container, forKeyIfPresent: .prediction) + var _t_reason: ReasonX? = nil + if let reasonCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .reasonCodeableConcept) { + if _t_reason != nil { + throw DecodingError.dataCorruptedError(forKey: .reasonCodeableConcept, in: _container, debugDescription: "More than one value provided for \"reason\"") + } + _t_reason = .codeableConcept(reasonCodeableConcept) + } + if let reasonReference = try Reference(from: _container, forKeyIfPresent: .reasonReference) { + if _t_reason != nil { + throw DecodingError.dataCorruptedError(forKey: .reasonReference, in: _container, debugDescription: "More than one value provided for \"reason\"") + } + _t_reason = .reference(reasonReference) + } + self.reason = _t_reason + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKeyIfPresent: .subject) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try basedOn?.encode(on: &_container, forKey: .basedOn) + try basis?.encode(on: &_container, forKey: .basis) + try code?.encode(on: &_container, forKey: .code) + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try condition?.encode(on: &_container, forKey: .condition) + try context?.encode(on: &_container, forKey: .context) + try identifier?.encode(on: &_container, forKey: .identifier) + try method?.encode(on: &_container, forKey: .method) + try mitigation?.encode(on: &_container, forKey: .mitigation, auxiliaryKey: ._mitigation) + if let _enum = occurrence { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .occurrencePeriod) + } + } + try parent?.encode(on: &_container, forKey: .parent) + try performer?.encode(on: &_container, forKey: .performer) + try prediction?.encode(on: &_container, forKey: .prediction) + if let _enum = reason { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .reasonCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .reasonReference) + } + } + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject?.encode(on: &_container, forKey: .subject) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? RiskAssessment else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return basedOn == _other.basedOn + && basis == _other.basis + && code == _other.code + && comment == _other.comment + && condition == _other.condition + && context == _other.context + && identifier == _other.identifier + && method == _other.method + && mitigation == _other.mitigation + && occurrence == _other.occurrence + && parent == _other.parent + && performer == _other.performer + && prediction == _other.prediction + && reason == _other.reason + && status == _other.status + && subject == _other.subject + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(basedOn) + hasher.combine(basis) + hasher.combine(code) + hasher.combine(comment) + hasher.combine(condition) + hasher.combine(context) + hasher.combine(identifier) + hasher.combine(method) + hasher.combine(mitigation) + hasher.combine(occurrence) + hasher.combine(parent) + hasher.combine(performer) + hasher.combine(prediction) + hasher.combine(reason) + hasher.combine(status) + hasher.combine(subject) + } +} + +/** + Outcome predicted. + + Describes the expected outcome for the subject. + */ +open class RiskAssessmentPrediction: BackboneElement { + + /// All possible types for "probability[x]" + public enum ProbabilityX: Hashable { + case decimal(FHIRPrimitive) + case range(Range) + } + + /// All possible types for "when[x]" + public enum WhenX: Hashable { + case period(Period) + case range(Range) + } + + /// Possible outcome for the subject + public var outcome: CodeableConcept + + /// Likelihood of specified outcome + /// One of `probability[x]` + public var probability: ProbabilityX? + + /// Likelihood of specified outcome as a qualitative value + public var qualitativeRisk: CodeableConcept? + + /// Relative likelihood + public var relativeRisk: FHIRPrimitive? + + /// Timeframe or age range + /// One of `when[x]` + public var when: WhenX? + + /// Explanation of prediction + public var rationale: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(outcome: CodeableConcept) { + self.outcome = outcome + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + outcome: CodeableConcept, + probability: ProbabilityX? = nil, + qualitativeRisk: CodeableConcept? = nil, + rationale: FHIRPrimitive? = nil, + relativeRisk: FHIRPrimitive? = nil, + when: WhenX? = nil) + { + self.init(outcome: outcome) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.probability = probability + self.qualitativeRisk = qualitativeRisk + self.rationale = rationale + self.relativeRisk = relativeRisk + self.when = when + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case outcome + case probabilityDecimal; case _probabilityDecimal + case probabilityRange + case qualitativeRisk + case rationale; case _rationale + case relativeRisk; case _relativeRisk + case whenPeriod + case whenRange + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.outcome = try CodeableConcept(from: _container, forKey: .outcome) + var _t_probability: ProbabilityX? = nil + if let probabilityDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .probabilityDecimal, auxiliaryKey: ._probabilityDecimal) { + if _t_probability != nil { + throw DecodingError.dataCorruptedError(forKey: .probabilityDecimal, in: _container, debugDescription: "More than one value provided for \"probability\"") + } + _t_probability = .decimal(probabilityDecimal) + } + if let probabilityRange = try Range(from: _container, forKeyIfPresent: .probabilityRange) { + if _t_probability != nil { + throw DecodingError.dataCorruptedError(forKey: .probabilityRange, in: _container, debugDescription: "More than one value provided for \"probability\"") + } + _t_probability = .range(probabilityRange) + } + self.probability = _t_probability + self.qualitativeRisk = try CodeableConcept(from: _container, forKeyIfPresent: .qualitativeRisk) + self.rationale = try FHIRPrimitive(from: _container, forKeyIfPresent: .rationale, auxiliaryKey: ._rationale) + self.relativeRisk = try FHIRPrimitive(from: _container, forKeyIfPresent: .relativeRisk, auxiliaryKey: ._relativeRisk) + var _t_when: WhenX? = nil + if let whenPeriod = try Period(from: _container, forKeyIfPresent: .whenPeriod) { + if _t_when != nil { + throw DecodingError.dataCorruptedError(forKey: .whenPeriod, in: _container, debugDescription: "More than one value provided for \"when\"") + } + _t_when = .period(whenPeriod) + } + if let whenRange = try Range(from: _container, forKeyIfPresent: .whenRange) { + if _t_when != nil { + throw DecodingError.dataCorruptedError(forKey: .whenRange, in: _container, debugDescription: "More than one value provided for \"when\"") + } + _t_when = .range(whenRange) + } + self.when = _t_when + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try outcome.encode(on: &_container, forKey: .outcome) + if let _enum = probability { + switch _enum { + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .probabilityDecimal, auxiliaryKey: ._probabilityDecimal) + case .range(let _value): + try _value.encode(on: &_container, forKey: .probabilityRange) + } + } + try qualitativeRisk?.encode(on: &_container, forKey: .qualitativeRisk) + try rationale?.encode(on: &_container, forKey: .rationale, auxiliaryKey: ._rationale) + try relativeRisk?.encode(on: &_container, forKey: .relativeRisk, auxiliaryKey: ._relativeRisk) + if let _enum = when { + switch _enum { + case .period(let _value): + try _value.encode(on: &_container, forKey: .whenPeriod) + case .range(let _value): + try _value.encode(on: &_container, forKey: .whenRange) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? RiskAssessmentPrediction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return outcome == _other.outcome + && probability == _other.probability + && qualitativeRisk == _other.qualitativeRisk + && rationale == _other.rationale + && relativeRisk == _other.relativeRisk + && when == _other.when + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(outcome) + hasher.combine(probability) + hasher.combine(qualitativeRisk) + hasher.combine(rationale) + hasher.combine(relativeRisk) + hasher.combine(when) + } +} diff --git a/Sources/ModelsSTU3/SampledData.swift b/Sources/ModelsSTU3/SampledData.swift new file mode 100644 index 0000000..ae47b63 --- /dev/null +++ b/Sources/ModelsSTU3/SampledData.swift @@ -0,0 +1,150 @@ +// +// SampledData.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/SampledData) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A series of measurements taken by a device. + + A series of measurements taken by a device, with upper and lower limits. There may be more than one dimension in the + data. + */ +open class SampledData: Element { + + /// Zero value and units + public var origin: Quantity + + /// Number of milliseconds between samples + public var period: FHIRPrimitive + + /// Multiply data by this before adding to origin + public var factor: FHIRPrimitive? + + /// Lower limit of detection + public var lowerLimit: FHIRPrimitive? + + /// Upper limit of detection + public var upperLimit: FHIRPrimitive? + + /// Number of sample points at each time point + public var dimensions: FHIRPrimitive + + /// Decimal values with spaces, or "E" | "U" | "L" + public var data: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(data: FHIRPrimitive, dimensions: FHIRPrimitive, origin: Quantity, period: FHIRPrimitive) { + self.data = data + self.dimensions = dimensions + self.origin = origin + self.period = period + super.init() + } + + /// Convenience initializer + public convenience init( + data: FHIRPrimitive, + dimensions: FHIRPrimitive, + `extension`: [Extension]? = nil, + factor: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + lowerLimit: FHIRPrimitive? = nil, + origin: Quantity, + period: FHIRPrimitive, + upperLimit: FHIRPrimitive? = nil) + { + self.init(data: data, dimensions: dimensions, origin: origin, period: period) + self.`extension` = `extension` + self.factor = factor + self.id = id + self.lowerLimit = lowerLimit + self.upperLimit = upperLimit + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case data; case _data + case dimensions; case _dimensions + case factor; case _factor + case lowerLimit; case _lowerLimit + case origin + case period; case _period + case upperLimit; case _upperLimit + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.data = try FHIRPrimitive(from: _container, forKey: .data, auxiliaryKey: ._data) + self.dimensions = try FHIRPrimitive(from: _container, forKey: .dimensions, auxiliaryKey: ._dimensions) + self.factor = try FHIRPrimitive(from: _container, forKeyIfPresent: .factor, auxiliaryKey: ._factor) + self.lowerLimit = try FHIRPrimitive(from: _container, forKeyIfPresent: .lowerLimit, auxiliaryKey: ._lowerLimit) + self.origin = try Quantity(from: _container, forKey: .origin) + self.period = try FHIRPrimitive(from: _container, forKey: .period, auxiliaryKey: ._period) + self.upperLimit = try FHIRPrimitive(from: _container, forKeyIfPresent: .upperLimit, auxiliaryKey: ._upperLimit) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try data.encode(on: &_container, forKey: .data, auxiliaryKey: ._data) + try dimensions.encode(on: &_container, forKey: .dimensions, auxiliaryKey: ._dimensions) + try factor?.encode(on: &_container, forKey: .factor, auxiliaryKey: ._factor) + try lowerLimit?.encode(on: &_container, forKey: .lowerLimit, auxiliaryKey: ._lowerLimit) + try origin.encode(on: &_container, forKey: .origin) + try period.encode(on: &_container, forKey: .period, auxiliaryKey: ._period) + try upperLimit?.encode(on: &_container, forKey: .upperLimit, auxiliaryKey: ._upperLimit) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SampledData else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return data == _other.data + && dimensions == _other.dimensions + && factor == _other.factor + && lowerLimit == _other.lowerLimit + && origin == _other.origin + && period == _other.period + && upperLimit == _other.upperLimit + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(data) + hasher.combine(dimensions) + hasher.combine(factor) + hasher.combine(lowerLimit) + hasher.combine(origin) + hasher.combine(period) + hasher.combine(upperLimit) + } +} diff --git a/Sources/ModelsSTU3/Schedule.swift b/Sources/ModelsSTU3/Schedule.swift new file mode 100644 index 0000000..9b602aa --- /dev/null +++ b/Sources/ModelsSTU3/Schedule.swift @@ -0,0 +1,175 @@ +// +// Schedule.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Schedule) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A container for slots of time that may be available for booking appointments. + */ +open class Schedule: DomainResource { + + override open class var resourceType: ResourceType { return .schedule } + + /// External Ids for this item + public var identifier: [Identifier]? + + /// Whether this schedule is in active use + public var active: FHIRPrimitive? + + /// A broad categorisation of the service that is to be performed during this appointment + public var serviceCategory: CodeableConcept? + + /// The specific service that is to be performed during this appointment + public var serviceType: [CodeableConcept]? + + /// The specialty of a practitioner that would be required to perform the service requested in this appointment + public var specialty: [CodeableConcept]? + + /// The resource this Schedule resource is providing availability information for. These are expected to usually be + /// one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson + public var actor: [Reference] + + /// The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These + /// cover the amount of time that an organization's planning horizon; the interval for which they are currently + /// accepting appointments. This does not define a "template" for planning outside these dates + public var planningHorizon: Period? + + /// Comments on the availability to describe any extended information. Such as custom constraints on the slots that + /// may be associated + public var comment: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(actor: [Reference]) { + self.actor = actor + super.init() + } + + /// Convenience initializer + public convenience init( + active: FHIRPrimitive? = nil, + actor: [Reference], + comment: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + planningHorizon: Period? = nil, + serviceCategory: CodeableConcept? = nil, + serviceType: [CodeableConcept]? = nil, + specialty: [CodeableConcept]? = nil, + text: Narrative? = nil) + { + self.init(actor: actor) + self.active = active + self.comment = comment + self.contained = contained + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.planningHorizon = planningHorizon + self.serviceCategory = serviceCategory + self.serviceType = serviceType + self.specialty = specialty + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case active; case _active + case actor + case comment; case _comment + case identifier + case planningHorizon + case serviceCategory + case serviceType + case specialty + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.active = try FHIRPrimitive(from: _container, forKeyIfPresent: .active, auxiliaryKey: ._active) + self.actor = try [Reference](from: _container, forKey: .actor) + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.planningHorizon = try Period(from: _container, forKeyIfPresent: .planningHorizon) + self.serviceCategory = try CodeableConcept(from: _container, forKeyIfPresent: .serviceCategory) + self.serviceType = try [CodeableConcept](from: _container, forKeyIfPresent: .serviceType) + self.specialty = try [CodeableConcept](from: _container, forKeyIfPresent: .specialty) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try active?.encode(on: &_container, forKey: .active, auxiliaryKey: ._active) + try actor.encode(on: &_container, forKey: .actor) + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try identifier?.encode(on: &_container, forKey: .identifier) + try planningHorizon?.encode(on: &_container, forKey: .planningHorizon) + try serviceCategory?.encode(on: &_container, forKey: .serviceCategory) + try serviceType?.encode(on: &_container, forKey: .serviceType) + try specialty?.encode(on: &_container, forKey: .specialty) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Schedule else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return active == _other.active + && actor == _other.actor + && comment == _other.comment + && identifier == _other.identifier + && planningHorizon == _other.planningHorizon + && serviceCategory == _other.serviceCategory + && serviceType == _other.serviceType + && specialty == _other.specialty + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(active) + hasher.combine(actor) + hasher.combine(comment) + hasher.combine(identifier) + hasher.combine(planningHorizon) + hasher.combine(serviceCategory) + hasher.combine(serviceType) + hasher.combine(specialty) + } +} diff --git a/Sources/ModelsSTU3/SearchParameter.swift b/Sources/ModelsSTU3/SearchParameter.swift new file mode 100644 index 0000000..02adb0e --- /dev/null +++ b/Sources/ModelsSTU3/SearchParameter.swift @@ -0,0 +1,414 @@ +// +// SearchParameter.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/SearchParameter) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Search Parameter for a resource. + + A search parameter that defines a named search item that can be used to search/filter on a resource. + */ +open class SearchParameter: DomainResource { + + override open class var resourceType: ResourceType { return .searchParameter } + + /// Logical URI to reference this search parameter (globally unique) + public var url: FHIRPrimitive + + /// Business version of the search parameter + public var version: FHIRPrimitive? + + /// Name for this search parameter (computer friendly) + public var name: FHIRPrimitive + + /// The status of this search parameter. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for search parameter (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Why this search parameter is defined + public var purpose: FHIRPrimitive? + + /// Code used in URL + public var code: FHIRPrimitive + + /// The base resource type(s) that this search parameter can be used against. + public var base: [FHIRPrimitive] + + /// The type of value a search parameter refers to, and how the content is interpreted. + public var type: FHIRPrimitive + + /// Original Definition for the search parameter + public var derivedFrom: FHIRPrimitive? + + /// Natural language description of the search parameter + public var description_fhir: FHIRPrimitive + + /// FHIRPath expression that extracts the values + public var expression: FHIRPrimitive? + + /// XPath that extracts the values + public var xpath: FHIRPrimitive? + + /// How the search parameter relates to the set of elements returned by evaluating the xpath query. + public var xpathUsage: FHIRPrimitive? + + /// Types of resource (if a resource is referenced). + public var target: [FHIRPrimitive]? + + /// Comparators supported for the search parameter. + public var comparator: [FHIRPrimitive]? + + /// A modifier supported for the search parameter. + public var modifier: [FHIRPrimitive]? + + /// Chained names supported + public var chain: [FHIRPrimitive]? + + /// For Composite resources to define the parts + public var component: [SearchParameterComponent]? + + /// Designated initializer taking all required properties + public init(base: [FHIRPrimitive], code: FHIRPrimitive, description_fhir: FHIRPrimitive, name: FHIRPrimitive, status: FHIRPrimitive, type: FHIRPrimitive, url: FHIRPrimitive) { + self.base = base + self.code = code + self.description_fhir = description_fhir + self.name = name + self.status = status + self.type = type + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + base: [FHIRPrimitive], + chain: [FHIRPrimitive]? = nil, + code: FHIRPrimitive, + comparator: [FHIRPrimitive]? = nil, + component: [SearchParameterComponent]? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + date: FHIRPrimitive? = nil, + derivedFrom: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive, + experimental: FHIRPrimitive? = nil, + expression: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifier: [FHIRPrimitive]? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + status: FHIRPrimitive, + target: [FHIRPrimitive]? = nil, + text: Narrative? = nil, + type: FHIRPrimitive, + url: FHIRPrimitive, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil, + xpath: FHIRPrimitive? = nil, + xpathUsage: FHIRPrimitive? = nil) + { + self.init(base: base, code: code, description_fhir: description_fhir, name: name, status: status, type: type, url: url) + self.chain = chain + self.comparator = comparator + self.component = component + self.contact = contact + self.contained = contained + self.date = date + self.derivedFrom = derivedFrom + self.experimental = experimental + self.expression = expression + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.modifier = modifier + self.modifierExtension = modifierExtension + self.publisher = publisher + self.purpose = purpose + self.target = target + self.text = text + self.useContext = useContext + self.version = version + self.xpath = xpath + self.xpathUsage = xpathUsage + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case base; case _base + case chain; case _chain + case code; case _code + case comparator; case _comparator + case component + case contact + case date; case _date + case derivedFrom; case _derivedFrom + case description_fhir = "description"; case _description_fhir = "_description" + case experimental; case _experimental + case expression; case _expression + case jurisdiction + case modifier; case _modifier + case name; case _name + case publisher; case _publisher + case purpose; case _purpose + case status; case _status + case target; case _target + case type; case _type + case url; case _url + case useContext + case version; case _version + case xpath; case _xpath + case xpathUsage; case _xpathUsage + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.base = try [FHIRPrimitive](from: _container, forKey: .base, auxiliaryKey: ._base) + self.chain = try [FHIRPrimitive](from: _container, forKeyIfPresent: .chain, auxiliaryKey: ._chain) + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.comparator = try [FHIRPrimitive](from: _container, forKeyIfPresent: .comparator, auxiliaryKey: ._comparator) + self.component = try [SearchParameterComponent](from: _container, forKeyIfPresent: .component) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.derivedFrom = try FHIRPrimitive(from: _container, forKeyIfPresent: .derivedFrom, auxiliaryKey: ._derivedFrom) + self.description_fhir = try FHIRPrimitive(from: _container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.expression = try FHIRPrimitive(from: _container, forKeyIfPresent: .expression, auxiliaryKey: ._expression) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.modifier = try [FHIRPrimitive](from: _container, forKeyIfPresent: .modifier, auxiliaryKey: ._modifier) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.target = try [FHIRPrimitive](from: _container, forKeyIfPresent: .target, auxiliaryKey: ._target) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + self.xpath = try FHIRPrimitive(from: _container, forKeyIfPresent: .xpath, auxiliaryKey: ._xpath) + self.xpathUsage = try FHIRPrimitive(from: _container, forKeyIfPresent: .xpathUsage, auxiliaryKey: ._xpathUsage) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try base.encode(on: &_container, forKey: .base, auxiliaryKey: ._base) + try chain?.encode(on: &_container, forKey: .chain, auxiliaryKey: ._chain) + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try comparator?.encode(on: &_container, forKey: .comparator, auxiliaryKey: ._comparator) + try component?.encode(on: &_container, forKey: .component) + try contact?.encode(on: &_container, forKey: .contact) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try derivedFrom?.encode(on: &_container, forKey: .derivedFrom, auxiliaryKey: ._derivedFrom) + try description_fhir.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try expression?.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try modifier?.encode(on: &_container, forKey: .modifier, auxiliaryKey: ._modifier) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try target?.encode(on: &_container, forKey: .target, auxiliaryKey: ._target) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try xpath?.encode(on: &_container, forKey: .xpath, auxiliaryKey: ._xpath) + try xpathUsage?.encode(on: &_container, forKey: .xpathUsage, auxiliaryKey: ._xpathUsage) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SearchParameter else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return base == _other.base + && chain == _other.chain + && code == _other.code + && comparator == _other.comparator + && component == _other.component + && contact == _other.contact + && date == _other.date + && derivedFrom == _other.derivedFrom + && description_fhir == _other.description_fhir + && experimental == _other.experimental + && expression == _other.expression + && jurisdiction == _other.jurisdiction + && modifier == _other.modifier + && name == _other.name + && publisher == _other.publisher + && purpose == _other.purpose + && status == _other.status + && target == _other.target + && type == _other.type + && url == _other.url + && useContext == _other.useContext + && version == _other.version + && xpath == _other.xpath + && xpathUsage == _other.xpathUsage + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(base) + hasher.combine(chain) + hasher.combine(code) + hasher.combine(comparator) + hasher.combine(component) + hasher.combine(contact) + hasher.combine(date) + hasher.combine(derivedFrom) + hasher.combine(description_fhir) + hasher.combine(experimental) + hasher.combine(expression) + hasher.combine(jurisdiction) + hasher.combine(modifier) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(status) + hasher.combine(target) + hasher.combine(type) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + hasher.combine(xpath) + hasher.combine(xpathUsage) + } +} + +/** + For Composite resources to define the parts. + + Used to define the parts of a composite search parameter. + */ +open class SearchParameterComponent: BackboneElement { + + /// Defines how the part works + public var definition: Reference + + /// Subexpression relative to main expression + public var expression: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(definition: Reference, expression: FHIRPrimitive) { + self.definition = definition + self.expression = expression + super.init() + } + + /// Convenience initializer + public convenience init( + definition: Reference, + expression: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(definition: definition, expression: expression) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case definition + case expression; case _expression + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.definition = try Reference(from: _container, forKey: .definition) + self.expression = try FHIRPrimitive(from: _container, forKey: .expression, auxiliaryKey: ._expression) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try definition.encode(on: &_container, forKey: .definition) + try expression.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SearchParameterComponent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return definition == _other.definition + && expression == _other.expression + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(definition) + hasher.combine(expression) + } +} diff --git a/Sources/ModelsSTU3/Sequence.swift b/Sources/ModelsSTU3/Sequence.swift new file mode 100644 index 0000000..7ebbb4a --- /dev/null +++ b/Sources/ModelsSTU3/Sequence.swift @@ -0,0 +1,833 @@ +// +// Sequence.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Sequence) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Information about a biological sequence. + + Raw data describing a biological sequence. + */ +open class Sequence: DomainResource { + + override open class var resourceType: ResourceType { return .sequence } + + /// Unique ID for this particular sequence. This is a FHIR-defined id + public var identifier: [Identifier]? + + /// aa | dna | rna + public var type: FHIRPrimitive? + + /// Base number of coordinate system (0 for 0-based numbering or coordinates, inclusive start, exclusive end, 1 for + /// 1-based numbering, inclusive start, inclusive end) + public var coordinateSystem: FHIRPrimitive + + /// Who and/or what this is about + public var patient: Reference? + + /// Specimen used for sequencing + public var specimen: Reference? + + /// The method for sequencing + public var device: Reference? + + /// Who should be responsible for test result + public var performer: Reference? + + /// The number of copies of the seqeunce of interest. (RNASeq) + public var quantity: Quantity? + + /// A sequence used as reference + public var referenceSeq: SequenceReferenceSeq? + + /// Variant in sequence + public var variant: [SequenceVariant]? + + /// Sequence that was observed + public var observedSeq: FHIRPrimitive? + + /// An set of value as quality of sequence + public var quality: [SequenceQuality]? + + /// Average number of reads representing a given nucleotide in the reconstructed sequence + public var readCoverage: FHIRPrimitive? + + /// External repository which contains detailed report related with observedSeq in this resource + public var repository: [SequenceRepository]? + + /// Pointer to next atomic sequence + public var pointer: [Reference]? + + /// Designated initializer taking all required properties + public init(coordinateSystem: FHIRPrimitive) { + self.coordinateSystem = coordinateSystem + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + coordinateSystem: FHIRPrimitive, + device: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + observedSeq: FHIRPrimitive? = nil, + patient: Reference? = nil, + performer: Reference? = nil, + pointer: [Reference]? = nil, + quality: [SequenceQuality]? = nil, + quantity: Quantity? = nil, + readCoverage: FHIRPrimitive? = nil, + referenceSeq: SequenceReferenceSeq? = nil, + repository: [SequenceRepository]? = nil, + specimen: Reference? = nil, + text: Narrative? = nil, + type: FHIRPrimitive? = nil, + variant: [SequenceVariant]? = nil) + { + self.init(coordinateSystem: coordinateSystem) + self.contained = contained + self.device = device + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.observedSeq = observedSeq + self.patient = patient + self.performer = performer + self.pointer = pointer + self.quality = quality + self.quantity = quantity + self.readCoverage = readCoverage + self.referenceSeq = referenceSeq + self.repository = repository + self.specimen = specimen + self.text = text + self.type = type + self.variant = variant + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case coordinateSystem; case _coordinateSystem + case device + case identifier + case observedSeq; case _observedSeq + case patient + case performer + case pointer + case quality + case quantity + case readCoverage; case _readCoverage + case referenceSeq + case repository + case specimen + case type; case _type + case variant + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.coordinateSystem = try FHIRPrimitive(from: _container, forKey: .coordinateSystem, auxiliaryKey: ._coordinateSystem) + self.device = try Reference(from: _container, forKeyIfPresent: .device) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.observedSeq = try FHIRPrimitive(from: _container, forKeyIfPresent: .observedSeq, auxiliaryKey: ._observedSeq) + self.patient = try Reference(from: _container, forKeyIfPresent: .patient) + self.performer = try Reference(from: _container, forKeyIfPresent: .performer) + self.pointer = try [Reference](from: _container, forKeyIfPresent: .pointer) + self.quality = try [SequenceQuality](from: _container, forKeyIfPresent: .quality) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + self.readCoverage = try FHIRPrimitive(from: _container, forKeyIfPresent: .readCoverage, auxiliaryKey: ._readCoverage) + self.referenceSeq = try SequenceReferenceSeq(from: _container, forKeyIfPresent: .referenceSeq) + self.repository = try [SequenceRepository](from: _container, forKeyIfPresent: .repository) + self.specimen = try Reference(from: _container, forKeyIfPresent: .specimen) + self.type = try FHIRPrimitive(from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + self.variant = try [SequenceVariant](from: _container, forKeyIfPresent: .variant) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try coordinateSystem.encode(on: &_container, forKey: .coordinateSystem, auxiliaryKey: ._coordinateSystem) + try device?.encode(on: &_container, forKey: .device) + try identifier?.encode(on: &_container, forKey: .identifier) + try observedSeq?.encode(on: &_container, forKey: .observedSeq, auxiliaryKey: ._observedSeq) + try patient?.encode(on: &_container, forKey: .patient) + try performer?.encode(on: &_container, forKey: .performer) + try pointer?.encode(on: &_container, forKey: .pointer) + try quality?.encode(on: &_container, forKey: .quality) + try quantity?.encode(on: &_container, forKey: .quantity) + try readCoverage?.encode(on: &_container, forKey: .readCoverage, auxiliaryKey: ._readCoverage) + try referenceSeq?.encode(on: &_container, forKey: .referenceSeq) + try repository?.encode(on: &_container, forKey: .repository) + try specimen?.encode(on: &_container, forKey: .specimen) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try variant?.encode(on: &_container, forKey: .variant) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Sequence else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return coordinateSystem == _other.coordinateSystem + && device == _other.device + && identifier == _other.identifier + && observedSeq == _other.observedSeq + && patient == _other.patient + && performer == _other.performer + && pointer == _other.pointer + && quality == _other.quality + && quantity == _other.quantity + && readCoverage == _other.readCoverage + && referenceSeq == _other.referenceSeq + && repository == _other.repository + && specimen == _other.specimen + && type == _other.type + && variant == _other.variant + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(coordinateSystem) + hasher.combine(device) + hasher.combine(identifier) + hasher.combine(observedSeq) + hasher.combine(patient) + hasher.combine(performer) + hasher.combine(pointer) + hasher.combine(quality) + hasher.combine(quantity) + hasher.combine(readCoverage) + hasher.combine(referenceSeq) + hasher.combine(repository) + hasher.combine(specimen) + hasher.combine(type) + hasher.combine(variant) + } +} + +/** + An set of value as quality of sequence. + + An experimental feature attribute that defines the quality of the feature in a quantitative way, such as a phred + quality score ([SO:0001686](http://www.sequenceontology.org/browser/current_svn/term/SO:0001686)). + */ +open class SequenceQuality: BackboneElement { + + /// INDEL / SNP / Undefined variant. + public var type: FHIRPrimitive + + /// Standard sequence for comparison + public var standardSequence: CodeableConcept? + + /// Start position of the sequence + public var start: FHIRPrimitive? + + /// End position of the sequence + public var end: FHIRPrimitive? + + /// Quality score for the comparison + public var score: Quantity? + + /// Method to get quality + public var method: CodeableConcept? + + /// True positives from the perspective of the truth data + public var truthTP: FHIRPrimitive? + + /// True positives from the perspective of the query data + public var queryTP: FHIRPrimitive? + + /// False negatives + public var truthFN: FHIRPrimitive? + + /// False positives + public var queryFP: FHIRPrimitive? + + /// False positives where the non-REF alleles in the Truth and Query Call Sets match + public var gtFP: FHIRPrimitive? + + /// Precision of comparison + public var precision: FHIRPrimitive? + + /// Recall of comparison + public var recall: FHIRPrimitive? + + /// F-score + public var fScore: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + end: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + fScore: FHIRPrimitive? = nil, + gtFP: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + method: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil, + precision: FHIRPrimitive? = nil, + queryFP: FHIRPrimitive? = nil, + queryTP: FHIRPrimitive? = nil, + recall: FHIRPrimitive? = nil, + score: Quantity? = nil, + standardSequence: CodeableConcept? = nil, + start: FHIRPrimitive? = nil, + truthFN: FHIRPrimitive? = nil, + truthTP: FHIRPrimitive? = nil, + type: FHIRPrimitive) + { + self.init(type: type) + self.end = end + self.`extension` = `extension` + self.fScore = fScore + self.gtFP = gtFP + self.id = id + self.method = method + self.modifierExtension = modifierExtension + self.precision = precision + self.queryFP = queryFP + self.queryTP = queryTP + self.recall = recall + self.score = score + self.standardSequence = standardSequence + self.start = start + self.truthFN = truthFN + self.truthTP = truthTP + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case end; case _end + case fScore; case _fScore + case gtFP; case _gtFP + case method + case precision; case _precision + case queryFP; case _queryFP + case queryTP; case _queryTP + case recall; case _recall + case score + case standardSequence + case start; case _start + case truthFN; case _truthFN + case truthTP; case _truthTP + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.end = try FHIRPrimitive(from: _container, forKeyIfPresent: .end, auxiliaryKey: ._end) + self.fScore = try FHIRPrimitive(from: _container, forKeyIfPresent: .fScore, auxiliaryKey: ._fScore) + self.gtFP = try FHIRPrimitive(from: _container, forKeyIfPresent: .gtFP, auxiliaryKey: ._gtFP) + self.method = try CodeableConcept(from: _container, forKeyIfPresent: .method) + self.precision = try FHIRPrimitive(from: _container, forKeyIfPresent: .precision, auxiliaryKey: ._precision) + self.queryFP = try FHIRPrimitive(from: _container, forKeyIfPresent: .queryFP, auxiliaryKey: ._queryFP) + self.queryTP = try FHIRPrimitive(from: _container, forKeyIfPresent: .queryTP, auxiliaryKey: ._queryTP) + self.recall = try FHIRPrimitive(from: _container, forKeyIfPresent: .recall, auxiliaryKey: ._recall) + self.score = try Quantity(from: _container, forKeyIfPresent: .score) + self.standardSequence = try CodeableConcept(from: _container, forKeyIfPresent: .standardSequence) + self.start = try FHIRPrimitive(from: _container, forKeyIfPresent: .start, auxiliaryKey: ._start) + self.truthFN = try FHIRPrimitive(from: _container, forKeyIfPresent: .truthFN, auxiliaryKey: ._truthFN) + self.truthTP = try FHIRPrimitive(from: _container, forKeyIfPresent: .truthTP, auxiliaryKey: ._truthTP) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try end?.encode(on: &_container, forKey: .end, auxiliaryKey: ._end) + try fScore?.encode(on: &_container, forKey: .fScore, auxiliaryKey: ._fScore) + try gtFP?.encode(on: &_container, forKey: .gtFP, auxiliaryKey: ._gtFP) + try method?.encode(on: &_container, forKey: .method) + try precision?.encode(on: &_container, forKey: .precision, auxiliaryKey: ._precision) + try queryFP?.encode(on: &_container, forKey: .queryFP, auxiliaryKey: ._queryFP) + try queryTP?.encode(on: &_container, forKey: .queryTP, auxiliaryKey: ._queryTP) + try recall?.encode(on: &_container, forKey: .recall, auxiliaryKey: ._recall) + try score?.encode(on: &_container, forKey: .score) + try standardSequence?.encode(on: &_container, forKey: .standardSequence) + try start?.encode(on: &_container, forKey: .start, auxiliaryKey: ._start) + try truthFN?.encode(on: &_container, forKey: .truthFN, auxiliaryKey: ._truthFN) + try truthTP?.encode(on: &_container, forKey: .truthTP, auxiliaryKey: ._truthTP) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SequenceQuality else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return end == _other.end + && fScore == _other.fScore + && gtFP == _other.gtFP + && method == _other.method + && precision == _other.precision + && queryFP == _other.queryFP + && queryTP == _other.queryTP + && recall == _other.recall + && score == _other.score + && standardSequence == _other.standardSequence + && start == _other.start + && truthFN == _other.truthFN + && truthTP == _other.truthTP + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(end) + hasher.combine(fScore) + hasher.combine(gtFP) + hasher.combine(method) + hasher.combine(precision) + hasher.combine(queryFP) + hasher.combine(queryTP) + hasher.combine(recall) + hasher.combine(score) + hasher.combine(standardSequence) + hasher.combine(start) + hasher.combine(truthFN) + hasher.combine(truthTP) + hasher.combine(type) + } +} + +/** + A sequence used as reference. + + A sequence that is used as a reference to describe variants that are present in a sequence analyzed. + */ +open class SequenceReferenceSeq: BackboneElement { + + /// Chromosome containing genetic finding + public var chromosome: CodeableConcept? + + /// The Genome Build used for reference, following GRCh build versions e.g. 'GRCh 37' + public var genomeBuild: FHIRPrimitive? + + /// Reference identifier + public var referenceSeqId: CodeableConcept? + + /// A Pointer to another Sequence entity as reference sequence + public var referenceSeqPointer: Reference? + + /// A string to represent reference sequence + public var referenceSeqString: FHIRPrimitive? + + /// Directionality of DNA ( +1/-1) + public var strand: FHIRPrimitive? + + /// Start position of the window on the reference sequence + public var windowStart: FHIRPrimitive + + /// End position of the window on the reference sequence + public var windowEnd: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(windowEnd: FHIRPrimitive, windowStart: FHIRPrimitive) { + self.windowEnd = windowEnd + self.windowStart = windowStart + super.init() + } + + /// Convenience initializer + public convenience init( + chromosome: CodeableConcept? = nil, + `extension`: [Extension]? = nil, + genomeBuild: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + referenceSeqId: CodeableConcept? = nil, + referenceSeqPointer: Reference? = nil, + referenceSeqString: FHIRPrimitive? = nil, + strand: FHIRPrimitive? = nil, + windowEnd: FHIRPrimitive, + windowStart: FHIRPrimitive) + { + self.init(windowEnd: windowEnd, windowStart: windowStart) + self.chromosome = chromosome + self.`extension` = `extension` + self.genomeBuild = genomeBuild + self.id = id + self.modifierExtension = modifierExtension + self.referenceSeqId = referenceSeqId + self.referenceSeqPointer = referenceSeqPointer + self.referenceSeqString = referenceSeqString + self.strand = strand + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case chromosome + case genomeBuild; case _genomeBuild + case referenceSeqId + case referenceSeqPointer + case referenceSeqString; case _referenceSeqString + case strand; case _strand + case windowEnd; case _windowEnd + case windowStart; case _windowStart + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.chromosome = try CodeableConcept(from: _container, forKeyIfPresent: .chromosome) + self.genomeBuild = try FHIRPrimitive(from: _container, forKeyIfPresent: .genomeBuild, auxiliaryKey: ._genomeBuild) + self.referenceSeqId = try CodeableConcept(from: _container, forKeyIfPresent: .referenceSeqId) + self.referenceSeqPointer = try Reference(from: _container, forKeyIfPresent: .referenceSeqPointer) + self.referenceSeqString = try FHIRPrimitive(from: _container, forKeyIfPresent: .referenceSeqString, auxiliaryKey: ._referenceSeqString) + self.strand = try FHIRPrimitive(from: _container, forKeyIfPresent: .strand, auxiliaryKey: ._strand) + self.windowEnd = try FHIRPrimitive(from: _container, forKey: .windowEnd, auxiliaryKey: ._windowEnd) + self.windowStart = try FHIRPrimitive(from: _container, forKey: .windowStart, auxiliaryKey: ._windowStart) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try chromosome?.encode(on: &_container, forKey: .chromosome) + try genomeBuild?.encode(on: &_container, forKey: .genomeBuild, auxiliaryKey: ._genomeBuild) + try referenceSeqId?.encode(on: &_container, forKey: .referenceSeqId) + try referenceSeqPointer?.encode(on: &_container, forKey: .referenceSeqPointer) + try referenceSeqString?.encode(on: &_container, forKey: .referenceSeqString, auxiliaryKey: ._referenceSeqString) + try strand?.encode(on: &_container, forKey: .strand, auxiliaryKey: ._strand) + try windowEnd.encode(on: &_container, forKey: .windowEnd, auxiliaryKey: ._windowEnd) + try windowStart.encode(on: &_container, forKey: .windowStart, auxiliaryKey: ._windowStart) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SequenceReferenceSeq else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return chromosome == _other.chromosome + && genomeBuild == _other.genomeBuild + && referenceSeqId == _other.referenceSeqId + && referenceSeqPointer == _other.referenceSeqPointer + && referenceSeqString == _other.referenceSeqString + && strand == _other.strand + && windowEnd == _other.windowEnd + && windowStart == _other.windowStart + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(chromosome) + hasher.combine(genomeBuild) + hasher.combine(referenceSeqId) + hasher.combine(referenceSeqPointer) + hasher.combine(referenceSeqString) + hasher.combine(strand) + hasher.combine(windowEnd) + hasher.combine(windowStart) + } +} + +/** + External repository which contains detailed report related with observedSeq in this resource. + + Configurations of the external repository. The repository shall store target's observedSeq or records related with + target's observedSeq. + */ +open class SequenceRepository: BackboneElement { + + /// Click and see / RESTful API / Need login to see / RESTful API with authentication / Other ways to see resource. + public var type: FHIRPrimitive + + /// URI of the repository + public var url: FHIRPrimitive? + + /// Repository's name + public var name: FHIRPrimitive? + + /// Id of the dataset that used to call for dataset in repository + public var datasetId: FHIRPrimitive? + + /// Id of the variantset that used to call for variantset in repository + public var variantsetId: FHIRPrimitive? + + /// Id of the read + public var readsetId: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + datasetId: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + readsetId: FHIRPrimitive? = nil, + type: FHIRPrimitive, + url: FHIRPrimitive? = nil, + variantsetId: FHIRPrimitive? = nil) + { + self.init(type: type) + self.datasetId = datasetId + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.name = name + self.readsetId = readsetId + self.url = url + self.variantsetId = variantsetId + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case datasetId; case _datasetId + case name; case _name + case readsetId; case _readsetId + case type; case _type + case url; case _url + case variantsetId; case _variantsetId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.datasetId = try FHIRPrimitive(from: _container, forKeyIfPresent: .datasetId, auxiliaryKey: ._datasetId) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.readsetId = try FHIRPrimitive(from: _container, forKeyIfPresent: .readsetId, auxiliaryKey: ._readsetId) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.variantsetId = try FHIRPrimitive(from: _container, forKeyIfPresent: .variantsetId, auxiliaryKey: ._variantsetId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try datasetId?.encode(on: &_container, forKey: .datasetId, auxiliaryKey: ._datasetId) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try readsetId?.encode(on: &_container, forKey: .readsetId, auxiliaryKey: ._readsetId) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try variantsetId?.encode(on: &_container, forKey: .variantsetId, auxiliaryKey: ._variantsetId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SequenceRepository else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return datasetId == _other.datasetId + && name == _other.name + && readsetId == _other.readsetId + && type == _other.type + && url == _other.url + && variantsetId == _other.variantsetId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(datasetId) + hasher.combine(name) + hasher.combine(readsetId) + hasher.combine(type) + hasher.combine(url) + hasher.combine(variantsetId) + } +} + +/** + Variant in sequence. + + The definition of variant here originates from Sequence ontology + ([variant_of](http://www.sequenceontology.org/browser/current_svn/term/variant_of)). This element can represent amino + acid or nucleic sequence change(including insertion,deletion,SNP,etc.) It can represent some complex mutation or + segment variation with the assist of CIGAR string. + */ +open class SequenceVariant: BackboneElement { + + /// Start position of the variant on the reference sequence + public var start: FHIRPrimitive? + + /// End position of the variant on the reference sequence + public var end: FHIRPrimitive? + + /// Allele that was observed + public var observedAllele: FHIRPrimitive? + + /// Allele in the reference sequence + public var referenceAllele: FHIRPrimitive? + + /// Extended CIGAR string for aligning the sequence with reference bases + public var cigar: FHIRPrimitive? + + /// Pointer to observed variant information + public var variantPointer: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + cigar: FHIRPrimitive? = nil, + end: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + observedAllele: FHIRPrimitive? = nil, + referenceAllele: FHIRPrimitive? = nil, + start: FHIRPrimitive? = nil, + variantPointer: Reference? = nil) + { + self.init() + self.cigar = cigar + self.end = end + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.observedAllele = observedAllele + self.referenceAllele = referenceAllele + self.start = start + self.variantPointer = variantPointer + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case cigar; case _cigar + case end; case _end + case observedAllele; case _observedAllele + case referenceAllele; case _referenceAllele + case start; case _start + case variantPointer + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.cigar = try FHIRPrimitive(from: _container, forKeyIfPresent: .cigar, auxiliaryKey: ._cigar) + self.end = try FHIRPrimitive(from: _container, forKeyIfPresent: .end, auxiliaryKey: ._end) + self.observedAllele = try FHIRPrimitive(from: _container, forKeyIfPresent: .observedAllele, auxiliaryKey: ._observedAllele) + self.referenceAllele = try FHIRPrimitive(from: _container, forKeyIfPresent: .referenceAllele, auxiliaryKey: ._referenceAllele) + self.start = try FHIRPrimitive(from: _container, forKeyIfPresent: .start, auxiliaryKey: ._start) + self.variantPointer = try Reference(from: _container, forKeyIfPresent: .variantPointer) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try cigar?.encode(on: &_container, forKey: .cigar, auxiliaryKey: ._cigar) + try end?.encode(on: &_container, forKey: .end, auxiliaryKey: ._end) + try observedAllele?.encode(on: &_container, forKey: .observedAllele, auxiliaryKey: ._observedAllele) + try referenceAllele?.encode(on: &_container, forKey: .referenceAllele, auxiliaryKey: ._referenceAllele) + try start?.encode(on: &_container, forKey: .start, auxiliaryKey: ._start) + try variantPointer?.encode(on: &_container, forKey: .variantPointer) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SequenceVariant else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return cigar == _other.cigar + && end == _other.end + && observedAllele == _other.observedAllele + && referenceAllele == _other.referenceAllele + && start == _other.start + && variantPointer == _other.variantPointer + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(cigar) + hasher.combine(end) + hasher.combine(observedAllele) + hasher.combine(referenceAllele) + hasher.combine(start) + hasher.combine(variantPointer) + } +} diff --git a/Sources/ModelsSTU3/ServiceDefinition.swift b/Sources/ModelsSTU3/ServiceDefinition.swift new file mode 100644 index 0000000..f05b782 --- /dev/null +++ b/Sources/ModelsSTU3/ServiceDefinition.swift @@ -0,0 +1,344 @@ +// +// ServiceDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ServiceDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A description of decision support service functionality. + + The ServiceDefinition describes a unit of decision support functionality that is made available as a service, such as + immunization modules or drug-drug interaction checking. + */ +open class ServiceDefinition: DomainResource { + + override open class var resourceType: ResourceType { return .serviceDefinition } + + /// Logical URI to reference this service definition (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the service definition + public var identifier: [Identifier]? + + /// Business version of the service definition + public var version: FHIRPrimitive? + + /// Name for this service definition (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this service definition (human friendly) + public var title: FHIRPrimitive? + + /// The status of this service definition. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Natural language description of the service definition + public var description_fhir: FHIRPrimitive? + + /// Why this service definition is defined + public var purpose: FHIRPrimitive? + + /// Describes the clinical usage of the module + public var usage: FHIRPrimitive? + + /// When the service definition was approved by publisher + public var approvalDate: FHIRPrimitive? + + /// When the service definition was last reviewed + public var lastReviewDate: FHIRPrimitive? + + /// When the service definition is expected to be used + public var effectivePeriod: Period? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for service definition (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// E.g. Education, Treatment, Assessment, etc + public var topic: [CodeableConcept]? + + /// A content contributor + public var contributor: [Contributor]? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Additional documentation, citations, etc + public var relatedArtifact: [RelatedArtifact]? + + /// "when" the module should be invoked + public var trigger: [TriggerDefinition]? + + /// What data is used by the module + public var dataRequirement: [DataRequirement]? + + /// Operation to invoke + public var operationDefinition: Reference? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + approvalDate: FHIRPrimitive? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + contributor: [Contributor]? = nil, + copyright: FHIRPrimitive? = nil, + dataRequirement: [DataRequirement]? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + effectivePeriod: Period? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + lastReviewDate: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + operationDefinition: Reference? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + relatedArtifact: [RelatedArtifact]? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + topic: [CodeableConcept]? = nil, + trigger: [TriggerDefinition]? = nil, + url: FHIRPrimitive? = nil, + usage: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(status: status) + self.approvalDate = approvalDate + self.contact = contact + self.contained = contained + self.contributor = contributor + self.copyright = copyright + self.dataRequirement = dataRequirement + self.date = date + self.description_fhir = description_fhir + self.effectivePeriod = effectivePeriod + self.experimental = experimental + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.lastReviewDate = lastReviewDate + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.operationDefinition = operationDefinition + self.publisher = publisher + self.purpose = purpose + self.relatedArtifact = relatedArtifact + self.text = text + self.title = title + self.topic = topic + self.trigger = trigger + self.url = url + self.usage = usage + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case approvalDate; case _approvalDate + case contact + case contributor + case copyright; case _copyright + case dataRequirement + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case effectivePeriod + case experimental; case _experimental + case identifier + case jurisdiction + case lastReviewDate; case _lastReviewDate + case name; case _name + case operationDefinition + case publisher; case _publisher + case purpose; case _purpose + case relatedArtifact + case status; case _status + case title; case _title + case topic + case trigger + case url; case _url + case usage; case _usage + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.approvalDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .approvalDate, auxiliaryKey: ._approvalDate) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.contributor = try [Contributor](from: _container, forKeyIfPresent: .contributor) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.dataRequirement = try [DataRequirement](from: _container, forKeyIfPresent: .dataRequirement) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.effectivePeriod = try Period(from: _container, forKeyIfPresent: .effectivePeriod) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.lastReviewDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.operationDefinition = try Reference(from: _container, forKeyIfPresent: .operationDefinition) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.relatedArtifact = try [RelatedArtifact](from: _container, forKeyIfPresent: .relatedArtifact) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.topic = try [CodeableConcept](from: _container, forKeyIfPresent: .topic) + self.trigger = try [TriggerDefinition](from: _container, forKeyIfPresent: .trigger) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.usage = try FHIRPrimitive(from: _container, forKeyIfPresent: .usage, auxiliaryKey: ._usage) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try approvalDate?.encode(on: &_container, forKey: .approvalDate, auxiliaryKey: ._approvalDate) + try contact?.encode(on: &_container, forKey: .contact) + try contributor?.encode(on: &_container, forKey: .contributor) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try dataRequirement?.encode(on: &_container, forKey: .dataRequirement) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try effectivePeriod?.encode(on: &_container, forKey: .effectivePeriod) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try lastReviewDate?.encode(on: &_container, forKey: .lastReviewDate, auxiliaryKey: ._lastReviewDate) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try operationDefinition?.encode(on: &_container, forKey: .operationDefinition) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try relatedArtifact?.encode(on: &_container, forKey: .relatedArtifact) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try topic?.encode(on: &_container, forKey: .topic) + try trigger?.encode(on: &_container, forKey: .trigger) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try usage?.encode(on: &_container, forKey: .usage, auxiliaryKey: ._usage) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ServiceDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return approvalDate == _other.approvalDate + && contact == _other.contact + && contributor == _other.contributor + && copyright == _other.copyright + && dataRequirement == _other.dataRequirement + && date == _other.date + && description_fhir == _other.description_fhir + && effectivePeriod == _other.effectivePeriod + && experimental == _other.experimental + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && lastReviewDate == _other.lastReviewDate + && name == _other.name + && operationDefinition == _other.operationDefinition + && publisher == _other.publisher + && purpose == _other.purpose + && relatedArtifact == _other.relatedArtifact + && status == _other.status + && title == _other.title + && topic == _other.topic + && trigger == _other.trigger + && url == _other.url + && usage == _other.usage + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(approvalDate) + hasher.combine(contact) + hasher.combine(contributor) + hasher.combine(copyright) + hasher.combine(dataRequirement) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(effectivePeriod) + hasher.combine(experimental) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(lastReviewDate) + hasher.combine(name) + hasher.combine(operationDefinition) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(relatedArtifact) + hasher.combine(status) + hasher.combine(title) + hasher.combine(topic) + hasher.combine(trigger) + hasher.combine(url) + hasher.combine(usage) + hasher.combine(useContext) + hasher.combine(version) + } +} diff --git a/Sources/ModelsSTU3/Signature.swift b/Sources/ModelsSTU3/Signature.swift new file mode 100644 index 0000000..25571f8 --- /dev/null +++ b/Sources/ModelsSTU3/Signature.swift @@ -0,0 +1,202 @@ +// +// Signature.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Signature) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A digital Signature - XML DigSig, JWT, Graphical image of signature, etc.. + + A digital signature along with supporting context. The signature may be electronic/cryptographic in nature, or a + graphical image representing a hand-written signature, or a signature process. Different signature approaches have + different utilities. + */ +open class Signature: Element { + + /// All possible types for "onBehalfOf[x]" + public enum OnBehalfOfX: Hashable { + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// All possible types for "who[x]" + public enum WhoX: Hashable { + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// Indication of the reason the entity signed the object(s) + public var type: [Coding] + + /// When the signature was created + public var when: FHIRPrimitive + + /// Who signed + /// One of `who[x]` + public var who: WhoX + + /// The party represented + /// One of `onBehalfOf[x]` + public var onBehalfOf: OnBehalfOfX? + + /// The technical format of the signature + public var contentType: FHIRPrimitive? + + /// The actual signature content (XML DigSig. JWT, picture, etc.) + public var blob: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(type: [Coding], when: FHIRPrimitive, who: WhoX) { + self.type = type + self.when = when + self.who = who + super.init() + } + + /// Convenience initializer + public convenience init( + blob: FHIRPrimitive? = nil, + contentType: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + onBehalfOf: OnBehalfOfX? = nil, + type: [Coding], + when: FHIRPrimitive, + who: WhoX) + { + self.init(type: type, when: when, who: who) + self.blob = blob + self.contentType = contentType + self.`extension` = `extension` + self.id = id + self.onBehalfOf = onBehalfOf + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case blob; case _blob + case contentType; case _contentType + case onBehalfOfReference + case onBehalfOfUri; case _onBehalfOfUri + case type + case when; case _when + case whoReference + case whoUri; case _whoUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.whoReference) || _container.contains(CodingKeys.whoUri) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.whoReference, CodingKeys.whoUri], debugDescription: "Must have at least one value for \"who\" but have none")) + } + + // Decode all our properties + self.blob = try FHIRPrimitive(from: _container, forKeyIfPresent: .blob, auxiliaryKey: ._blob) + self.contentType = try FHIRPrimitive(from: _container, forKeyIfPresent: .contentType, auxiliaryKey: ._contentType) + var _t_onBehalfOf: OnBehalfOfX? = nil + if let onBehalfOfUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .onBehalfOfUri, auxiliaryKey: ._onBehalfOfUri) { + if _t_onBehalfOf != nil { + throw DecodingError.dataCorruptedError(forKey: .onBehalfOfUri, in: _container, debugDescription: "More than one value provided for \"onBehalfOf\"") + } + _t_onBehalfOf = .uri(onBehalfOfUri) + } + if let onBehalfOfReference = try Reference(from: _container, forKeyIfPresent: .onBehalfOfReference) { + if _t_onBehalfOf != nil { + throw DecodingError.dataCorruptedError(forKey: .onBehalfOfReference, in: _container, debugDescription: "More than one value provided for \"onBehalfOf\"") + } + _t_onBehalfOf = .reference(onBehalfOfReference) + } + self.onBehalfOf = _t_onBehalfOf + self.type = try [Coding](from: _container, forKey: .type) + self.when = try FHIRPrimitive(from: _container, forKey: .when, auxiliaryKey: ._when) + var _t_who: WhoX? = nil + if let whoUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .whoUri, auxiliaryKey: ._whoUri) { + if _t_who != nil { + throw DecodingError.dataCorruptedError(forKey: .whoUri, in: _container, debugDescription: "More than one value provided for \"who\"") + } + _t_who = .uri(whoUri) + } + if let whoReference = try Reference(from: _container, forKeyIfPresent: .whoReference) { + if _t_who != nil { + throw DecodingError.dataCorruptedError(forKey: .whoReference, in: _container, debugDescription: "More than one value provided for \"who\"") + } + _t_who = .reference(whoReference) + } + self.who = _t_who! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try blob?.encode(on: &_container, forKey: .blob, auxiliaryKey: ._blob) + try contentType?.encode(on: &_container, forKey: .contentType, auxiliaryKey: ._contentType) + if let _enum = onBehalfOf { + switch _enum { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .onBehalfOfUri, auxiliaryKey: ._onBehalfOfUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .onBehalfOfReference) + } + } + try type.encode(on: &_container, forKey: .type) + try when.encode(on: &_container, forKey: .when, auxiliaryKey: ._when) + + switch who { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .whoUri, auxiliaryKey: ._whoUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .whoReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Signature else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return blob == _other.blob + && contentType == _other.contentType + && onBehalfOf == _other.onBehalfOf + && type == _other.type + && when == _other.when + && who == _other.who + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(blob) + hasher.combine(contentType) + hasher.combine(onBehalfOf) + hasher.combine(type) + hasher.combine(when) + hasher.combine(who) + } +} diff --git a/Sources/ModelsSTU3/Slot.swift b/Sources/ModelsSTU3/Slot.swift new file mode 100644 index 0000000..d4f6603 --- /dev/null +++ b/Sources/ModelsSTU3/Slot.swift @@ -0,0 +1,203 @@ +// +// Slot.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Slot) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A slot of time on a schedule that may be available for booking appointments. + */ +open class Slot: DomainResource { + + override open class var resourceType: ResourceType { return .slot } + + /// External Ids for this item + public var identifier: [Identifier]? + + /// A broad categorisation of the service that is to be performed during this appointment + public var serviceCategory: CodeableConcept? + + /// The type of appointments that can be booked into this slot (ideally this would be an identifiable service - + /// which is at a location, rather than the location itself). If provided then this overrides the value provided on + /// the availability resource + public var serviceType: [CodeableConcept]? + + /// The specialty of a practitioner that would be required to perform the service requested in this appointment + public var specialty: [CodeableConcept]? + + /// The style of appointment or patient that may be booked in the slot (not service type) + public var appointmentType: CodeableConcept? + + /// The schedule resource that this slot defines an interval of status information + public var schedule: Reference + + /// None + public var status: FHIRPrimitive + + /// Date/Time that the slot is to begin + public var start: FHIRPrimitive + + /// Date/Time that the slot is to conclude + public var end: FHIRPrimitive + + /// This slot has already been overbooked, appointments are unlikely to be accepted for this time + public var overbooked: FHIRPrimitive? + + /// Comments on the slot to describe any extended information. Such as custom constraints on the slot + public var comment: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(end: FHIRPrimitive, schedule: Reference, start: FHIRPrimitive, status: FHIRPrimitive) { + self.end = end + self.schedule = schedule + self.start = start + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + appointmentType: CodeableConcept? = nil, + comment: FHIRPrimitive? = nil, + contained: [ResourceProxy]? = nil, + end: FHIRPrimitive, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + overbooked: FHIRPrimitive? = nil, + schedule: Reference, + serviceCategory: CodeableConcept? = nil, + serviceType: [CodeableConcept]? = nil, + specialty: [CodeableConcept]? = nil, + start: FHIRPrimitive, + status: FHIRPrimitive, + text: Narrative? = nil) + { + self.init(end: end, schedule: schedule, start: start, status: status) + self.appointmentType = appointmentType + self.comment = comment + self.contained = contained + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.overbooked = overbooked + self.serviceCategory = serviceCategory + self.serviceType = serviceType + self.specialty = specialty + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case appointmentType + case comment; case _comment + case end; case _end + case identifier + case overbooked; case _overbooked + case schedule + case serviceCategory + case serviceType + case specialty + case start; case _start + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.appointmentType = try CodeableConcept(from: _container, forKeyIfPresent: .appointmentType) + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.end = try FHIRPrimitive(from: _container, forKey: .end, auxiliaryKey: ._end) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.overbooked = try FHIRPrimitive(from: _container, forKeyIfPresent: .overbooked, auxiliaryKey: ._overbooked) + self.schedule = try Reference(from: _container, forKey: .schedule) + self.serviceCategory = try CodeableConcept(from: _container, forKeyIfPresent: .serviceCategory) + self.serviceType = try [CodeableConcept](from: _container, forKeyIfPresent: .serviceType) + self.specialty = try [CodeableConcept](from: _container, forKeyIfPresent: .specialty) + self.start = try FHIRPrimitive(from: _container, forKey: .start, auxiliaryKey: ._start) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try appointmentType?.encode(on: &_container, forKey: .appointmentType) + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try end.encode(on: &_container, forKey: .end, auxiliaryKey: ._end) + try identifier?.encode(on: &_container, forKey: .identifier) + try overbooked?.encode(on: &_container, forKey: .overbooked, auxiliaryKey: ._overbooked) + try schedule.encode(on: &_container, forKey: .schedule) + try serviceCategory?.encode(on: &_container, forKey: .serviceCategory) + try serviceType?.encode(on: &_container, forKey: .serviceType) + try specialty?.encode(on: &_container, forKey: .specialty) + try start.encode(on: &_container, forKey: .start, auxiliaryKey: ._start) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Slot else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return appointmentType == _other.appointmentType + && comment == _other.comment + && end == _other.end + && identifier == _other.identifier + && overbooked == _other.overbooked + && schedule == _other.schedule + && serviceCategory == _other.serviceCategory + && serviceType == _other.serviceType + && specialty == _other.specialty + && start == _other.start + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(appointmentType) + hasher.combine(comment) + hasher.combine(end) + hasher.combine(identifier) + hasher.combine(overbooked) + hasher.combine(schedule) + hasher.combine(serviceCategory) + hasher.combine(serviceType) + hasher.combine(specialty) + hasher.combine(start) + hasher.combine(status) + } +} diff --git a/Sources/ModelsSTU3/Specimen.swift b/Sources/ModelsSTU3/Specimen.swift new file mode 100644 index 0000000..c0dd507 --- /dev/null +++ b/Sources/ModelsSTU3/Specimen.swift @@ -0,0 +1,631 @@ +// +// Specimen.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Specimen) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Sample for analysis. + + A sample to be used for analysis. + */ +open class Specimen: DomainResource { + + override open class var resourceType: ResourceType { return .specimen } + + /// External Identifier + public var identifier: [Identifier]? + + /// Identifier assigned by the lab + public var accessionIdentifier: Identifier? + + /// The availability of the specimen. + public var status: FHIRPrimitive? + + /// Kind of material that forms the specimen + public var type: CodeableConcept? + + /// Where the specimen came from. This may be from the patient(s) or from the environment or a device + public var subject: Reference + + /// The time when specimen was received for processing + public var receivedTime: FHIRPrimitive? + + /// Specimen from which this specimen originated + public var parent: [Reference]? + + /// Why the specimen was collected + public var request: [Reference]? + + /// Collection details + public var collection: SpecimenCollection? + + /// Processing and processing step details + public var processing: [SpecimenProcessing]? + + /// Direct container of specimen (tube/slide, etc.) + public var container: [SpecimenContainer]? + + /// Comments + public var note: [Annotation]? + + /// Designated initializer taking all required properties + public init(subject: Reference) { + self.subject = subject + super.init() + } + + /// Convenience initializer + public convenience init( + accessionIdentifier: Identifier? = nil, + collection: SpecimenCollection? = nil, + contained: [ResourceProxy]? = nil, + container: [SpecimenContainer]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + parent: [Reference]? = nil, + processing: [SpecimenProcessing]? = nil, + receivedTime: FHIRPrimitive? = nil, + request: [Reference]? = nil, + status: FHIRPrimitive? = nil, + subject: Reference, + text: Narrative? = nil, + type: CodeableConcept? = nil) + { + self.init(subject: subject) + self.accessionIdentifier = accessionIdentifier + self.collection = collection + self.contained = contained + self.container = container + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.parent = parent + self.processing = processing + self.receivedTime = receivedTime + self.request = request + self.status = status + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case accessionIdentifier + case collection + case container + case identifier + case note + case parent + case processing + case receivedTime; case _receivedTime + case request + case status; case _status + case subject + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.accessionIdentifier = try Identifier(from: _container, forKeyIfPresent: .accessionIdentifier) + self.collection = try SpecimenCollection(from: _container, forKeyIfPresent: .collection) + self.container = try [SpecimenContainer](from: _container, forKeyIfPresent: .container) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.parent = try [Reference](from: _container, forKeyIfPresent: .parent) + self.processing = try [SpecimenProcessing](from: _container, forKeyIfPresent: .processing) + self.receivedTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .receivedTime, auxiliaryKey: ._receivedTime) + self.request = try [Reference](from: _container, forKeyIfPresent: .request) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.subject = try Reference(from: _container, forKey: .subject) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try accessionIdentifier?.encode(on: &_container, forKey: .accessionIdentifier) + try collection?.encode(on: &_container, forKey: .collection) + try container?.encode(on: &_container, forKey: .container) + try identifier?.encode(on: &_container, forKey: .identifier) + try note?.encode(on: &_container, forKey: .note) + try parent?.encode(on: &_container, forKey: .parent) + try processing?.encode(on: &_container, forKey: .processing) + try receivedTime?.encode(on: &_container, forKey: .receivedTime, auxiliaryKey: ._receivedTime) + try request?.encode(on: &_container, forKey: .request) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try subject.encode(on: &_container, forKey: .subject) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Specimen else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return accessionIdentifier == _other.accessionIdentifier + && collection == _other.collection + && container == _other.container + && identifier == _other.identifier + && note == _other.note + && parent == _other.parent + && processing == _other.processing + && receivedTime == _other.receivedTime + && request == _other.request + && status == _other.status + && subject == _other.subject + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(accessionIdentifier) + hasher.combine(collection) + hasher.combine(container) + hasher.combine(identifier) + hasher.combine(note) + hasher.combine(parent) + hasher.combine(processing) + hasher.combine(receivedTime) + hasher.combine(request) + hasher.combine(status) + hasher.combine(subject) + hasher.combine(type) + } +} + +/** + Collection details. + + Details concerning the specimen collection. + */ +open class SpecimenCollection: BackboneElement { + + /// All possible types for "collected[x]" + public enum CollectedX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// Who collected the specimen + public var collector: Reference? + + /// Collection time + /// One of `collected[x]` + public var collected: CollectedX? + + /// The quantity of specimen collected + public var quantity: Quantity? + + /// Technique used to perform collection + public var method: CodeableConcept? + + /// Anatomical collection site + public var bodySite: CodeableConcept? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + bodySite: CodeableConcept? = nil, + collected: CollectedX? = nil, + collector: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + method: CodeableConcept? = nil, + modifierExtension: [Extension]? = nil, + quantity: Quantity? = nil) + { + self.init() + self.bodySite = bodySite + self.collected = collected + self.collector = collector + self.`extension` = `extension` + self.id = id + self.method = method + self.modifierExtension = modifierExtension + self.quantity = quantity + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case bodySite + case collectedDateTime; case _collectedDateTime + case collectedPeriod + case collector + case method + case quantity + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.bodySite = try CodeableConcept(from: _container, forKeyIfPresent: .bodySite) + var _t_collected: CollectedX? = nil + if let collectedDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .collectedDateTime, auxiliaryKey: ._collectedDateTime) { + if _t_collected != nil { + throw DecodingError.dataCorruptedError(forKey: .collectedDateTime, in: _container, debugDescription: "More than one value provided for \"collected\"") + } + _t_collected = .dateTime(collectedDateTime) + } + if let collectedPeriod = try Period(from: _container, forKeyIfPresent: .collectedPeriod) { + if _t_collected != nil { + throw DecodingError.dataCorruptedError(forKey: .collectedPeriod, in: _container, debugDescription: "More than one value provided for \"collected\"") + } + _t_collected = .period(collectedPeriod) + } + self.collected = _t_collected + self.collector = try Reference(from: _container, forKeyIfPresent: .collector) + self.method = try CodeableConcept(from: _container, forKeyIfPresent: .method) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try bodySite?.encode(on: &_container, forKey: .bodySite) + if let _enum = collected { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .collectedDateTime, auxiliaryKey: ._collectedDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .collectedPeriod) + } + } + try collector?.encode(on: &_container, forKey: .collector) + try method?.encode(on: &_container, forKey: .method) + try quantity?.encode(on: &_container, forKey: .quantity) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SpecimenCollection else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return bodySite == _other.bodySite + && collected == _other.collected + && collector == _other.collector + && method == _other.method + && quantity == _other.quantity + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(bodySite) + hasher.combine(collected) + hasher.combine(collector) + hasher.combine(method) + hasher.combine(quantity) + } +} + +/** + Direct container of specimen (tube/slide, etc.). + + The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not + addressed here. + */ +open class SpecimenContainer: BackboneElement { + + /// All possible types for "additive[x]" + public enum AdditiveX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Id for the container + public var identifier: [Identifier]? + + /// Textual description of the container + public var description_fhir: FHIRPrimitive? + + /// Kind of container directly associated with specimen + public var type: CodeableConcept? + + /// Container volume or size + public var capacity: Quantity? + + /// Quantity of specimen within container + public var specimenQuantity: Quantity? + + /// Additive associated with container + /// One of `additive[x]` + public var additive: AdditiveX? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + additive: AdditiveX? = nil, + capacity: Quantity? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + modifierExtension: [Extension]? = nil, + specimenQuantity: Quantity? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.additive = additive + self.capacity = capacity + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.specimenQuantity = specimenQuantity + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case additiveCodeableConcept + case additiveReference + case capacity + case description_fhir = "description"; case _description_fhir = "_description" + case identifier + case specimenQuantity + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_additive: AdditiveX? = nil + if let additiveCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .additiveCodeableConcept) { + if _t_additive != nil { + throw DecodingError.dataCorruptedError(forKey: .additiveCodeableConcept, in: _container, debugDescription: "More than one value provided for \"additive\"") + } + _t_additive = .codeableConcept(additiveCodeableConcept) + } + if let additiveReference = try Reference(from: _container, forKeyIfPresent: .additiveReference) { + if _t_additive != nil { + throw DecodingError.dataCorruptedError(forKey: .additiveReference, in: _container, debugDescription: "More than one value provided for \"additive\"") + } + _t_additive = .reference(additiveReference) + } + self.additive = _t_additive + self.capacity = try Quantity(from: _container, forKeyIfPresent: .capacity) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.specimenQuantity = try Quantity(from: _container, forKeyIfPresent: .specimenQuantity) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = additive { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .additiveCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .additiveReference) + } + } + try capacity?.encode(on: &_container, forKey: .capacity) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try identifier?.encode(on: &_container, forKey: .identifier) + try specimenQuantity?.encode(on: &_container, forKey: .specimenQuantity) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SpecimenContainer else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return additive == _other.additive + && capacity == _other.capacity + && description_fhir == _other.description_fhir + && identifier == _other.identifier + && specimenQuantity == _other.specimenQuantity + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(additive) + hasher.combine(capacity) + hasher.combine(description_fhir) + hasher.combine(identifier) + hasher.combine(specimenQuantity) + hasher.combine(type) + } +} + +/** + Processing and processing step details. + + Details concerning processing and processing steps for the specimen. + */ +open class SpecimenProcessing: BackboneElement { + + /// All possible types for "time[x]" + public enum TimeX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + } + + /// Textual description of procedure + public var description_fhir: FHIRPrimitive? + + /// Indicates the treatment step applied to the specimen + public var procedure: CodeableConcept? + + /// Material used in the processing step + public var additive: [Reference]? + + /// Date and time of specimen processing + /// One of `time[x]` + public var time: TimeX? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + additive: [Reference]? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + procedure: CodeableConcept? = nil, + time: TimeX? = nil) + { + self.init() + self.additive = additive + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.procedure = procedure + self.time = time + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case additive + case description_fhir = "description"; case _description_fhir = "_description" + case procedure + case timeDateTime; case _timeDateTime + case timePeriod + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.additive = try [Reference](from: _container, forKeyIfPresent: .additive) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.procedure = try CodeableConcept(from: _container, forKeyIfPresent: .procedure) + var _t_time: TimeX? = nil + if let timeDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .timeDateTime, auxiliaryKey: ._timeDateTime) { + if _t_time != nil { + throw DecodingError.dataCorruptedError(forKey: .timeDateTime, in: _container, debugDescription: "More than one value provided for \"time\"") + } + _t_time = .dateTime(timeDateTime) + } + if let timePeriod = try Period(from: _container, forKeyIfPresent: .timePeriod) { + if _t_time != nil { + throw DecodingError.dataCorruptedError(forKey: .timePeriod, in: _container, debugDescription: "More than one value provided for \"time\"") + } + _t_time = .period(timePeriod) + } + self.time = _t_time + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try additive?.encode(on: &_container, forKey: .additive) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try procedure?.encode(on: &_container, forKey: .procedure) + if let _enum = time { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .timeDateTime, auxiliaryKey: ._timeDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .timePeriod) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SpecimenProcessing else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return additive == _other.additive + && description_fhir == _other.description_fhir + && procedure == _other.procedure + && time == _other.time + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(additive) + hasher.combine(description_fhir) + hasher.combine(procedure) + hasher.combine(time) + } +} diff --git a/Sources/ModelsSTU3/StructureDefinition.swift b/Sources/ModelsSTU3/StructureDefinition.swift new file mode 100644 index 0000000..3dc4e37 --- /dev/null +++ b/Sources/ModelsSTU3/StructureDefinition.swift @@ -0,0 +1,618 @@ +// +// StructureDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/StructureDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Structural Definition. + + A definition of a FHIR structure. This resource is used to describe the underlying resources, data types defined in + FHIR, and also for describing extensions and constraints on resources and data types. + */ +open class StructureDefinition: DomainResource { + + override open class var resourceType: ResourceType { return .structureDefinition } + + /// Logical URI to reference this structure definition (globally unique) + public var url: FHIRPrimitive + + /// Additional identifier for the structure definition + public var identifier: [Identifier]? + + /// Business version of the structure definition + public var version: FHIRPrimitive? + + /// Name for this structure definition (computer friendly) + public var name: FHIRPrimitive + + /// Name for this structure definition (human friendly) + public var title: FHIRPrimitive? + + /// The status of this structure definition. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the structure definition + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for structure definition (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Why this structure definition is defined + public var purpose: FHIRPrimitive? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Assist with indexing and finding + public var keyword: [Coding]? + + /// FHIR Version this StructureDefinition targets + public var fhirVersion: FHIRPrimitive? + + /// External specification that the content is mapped to + public var mapping: [StructureDefinitionMapping]? + + /// Defines the kind of structure that this definition is describing. + public var kind: FHIRPrimitive + + /// Whether the structure is abstract + public var abstract: FHIRPrimitive + + /// If this is an extension, Identifies the context within FHIR resources where the extension can be used. + public var contextType: FHIRPrimitive? + + /// Where the extension can be used in instances + public var context: [FHIRPrimitive]? + + /// FHIRPath invariants - when the extension can be used + public var contextInvariant: [FHIRPrimitive]? + + /// Type defined or constrained by this structure + public var type: FHIRPrimitive + + /// Definition that this type is constrained/specialized from + public var baseDefinition: FHIRPrimitive? + + /// How the type relates to the baseDefinition. + public var derivation: FHIRPrimitive? + + /// Snapshot view of the structure + public var snapshot: StructureDefinitionSnapshot? + + /// Differential view of the structure + public var differential: StructureDefinitionDifferential? + + /// Designated initializer taking all required properties + public init(abstract: FHIRPrimitive, kind: FHIRPrimitive, name: FHIRPrimitive, status: FHIRPrimitive, type: FHIRPrimitive, url: FHIRPrimitive) { + self.abstract = abstract + self.kind = kind + self.name = name + self.status = status + self.type = type + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + abstract: FHIRPrimitive, + baseDefinition: FHIRPrimitive? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + context: [FHIRPrimitive]? = nil, + contextInvariant: [FHIRPrimitive]? = nil, + contextType: FHIRPrimitive? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + derivation: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + differential: StructureDefinitionDifferential? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + fhirVersion: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + keyword: [Coding]? = nil, + kind: FHIRPrimitive, + language: FHIRPrimitive? = nil, + mapping: [StructureDefinitionMapping]? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + snapshot: StructureDefinitionSnapshot? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + type: FHIRPrimitive, + url: FHIRPrimitive, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(abstract: abstract, kind: kind, name: name, status: status, type: type, url: url) + self.baseDefinition = baseDefinition + self.contact = contact + self.contained = contained + self.context = context + self.contextInvariant = contextInvariant + self.contextType = contextType + self.copyright = copyright + self.date = date + self.derivation = derivation + self.description_fhir = description_fhir + self.differential = differential + self.experimental = experimental + self.`extension` = `extension` + self.fhirVersion = fhirVersion + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.keyword = keyword + self.language = language + self.mapping = mapping + self.meta = meta + self.modifierExtension = modifierExtension + self.publisher = publisher + self.purpose = purpose + self.snapshot = snapshot + self.text = text + self.title = title + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case abstract; case _abstract + case baseDefinition; case _baseDefinition + case contact + case context; case _context + case contextInvariant; case _contextInvariant + case contextType; case _contextType + case copyright; case _copyright + case date; case _date + case derivation; case _derivation + case description_fhir = "description"; case _description_fhir = "_description" + case differential + case experimental; case _experimental + case fhirVersion; case _fhirVersion + case identifier + case jurisdiction + case keyword + case kind; case _kind + case mapping + case name; case _name + case publisher; case _publisher + case purpose; case _purpose + case snapshot + case status; case _status + case title; case _title + case type; case _type + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.abstract = try FHIRPrimitive(from: _container, forKey: .abstract, auxiliaryKey: ._abstract) + self.baseDefinition = try FHIRPrimitive(from: _container, forKeyIfPresent: .baseDefinition, auxiliaryKey: ._baseDefinition) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.context = try [FHIRPrimitive](from: _container, forKeyIfPresent: .context, auxiliaryKey: ._context) + self.contextInvariant = try [FHIRPrimitive](from: _container, forKeyIfPresent: .contextInvariant, auxiliaryKey: ._contextInvariant) + self.contextType = try FHIRPrimitive(from: _container, forKeyIfPresent: .contextType, auxiliaryKey: ._contextType) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.derivation = try FHIRPrimitive(from: _container, forKeyIfPresent: .derivation, auxiliaryKey: ._derivation) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.differential = try StructureDefinitionDifferential(from: _container, forKeyIfPresent: .differential) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.fhirVersion = try FHIRPrimitive(from: _container, forKeyIfPresent: .fhirVersion, auxiliaryKey: ._fhirVersion) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.keyword = try [Coding](from: _container, forKeyIfPresent: .keyword) + self.kind = try FHIRPrimitive(from: _container, forKey: .kind, auxiliaryKey: ._kind) + self.mapping = try [StructureDefinitionMapping](from: _container, forKeyIfPresent: .mapping) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.snapshot = try StructureDefinitionSnapshot(from: _container, forKeyIfPresent: .snapshot) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try abstract.encode(on: &_container, forKey: .abstract, auxiliaryKey: ._abstract) + try baseDefinition?.encode(on: &_container, forKey: .baseDefinition, auxiliaryKey: ._baseDefinition) + try contact?.encode(on: &_container, forKey: .contact) + try context?.encode(on: &_container, forKey: .context, auxiliaryKey: ._context) + try contextInvariant?.encode(on: &_container, forKey: .contextInvariant, auxiliaryKey: ._contextInvariant) + try contextType?.encode(on: &_container, forKey: .contextType, auxiliaryKey: ._contextType) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try derivation?.encode(on: &_container, forKey: .derivation, auxiliaryKey: ._derivation) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try differential?.encode(on: &_container, forKey: .differential) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try fhirVersion?.encode(on: &_container, forKey: .fhirVersion, auxiliaryKey: ._fhirVersion) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try keyword?.encode(on: &_container, forKey: .keyword) + try kind.encode(on: &_container, forKey: .kind, auxiliaryKey: ._kind) + try mapping?.encode(on: &_container, forKey: .mapping) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try snapshot?.encode(on: &_container, forKey: .snapshot) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return abstract == _other.abstract + && baseDefinition == _other.baseDefinition + && contact == _other.contact + && context == _other.context + && contextInvariant == _other.contextInvariant + && contextType == _other.contextType + && copyright == _other.copyright + && date == _other.date + && derivation == _other.derivation + && description_fhir == _other.description_fhir + && differential == _other.differential + && experimental == _other.experimental + && fhirVersion == _other.fhirVersion + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && keyword == _other.keyword + && kind == _other.kind + && mapping == _other.mapping + && name == _other.name + && publisher == _other.publisher + && purpose == _other.purpose + && snapshot == _other.snapshot + && status == _other.status + && title == _other.title + && type == _other.type + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(abstract) + hasher.combine(baseDefinition) + hasher.combine(contact) + hasher.combine(context) + hasher.combine(contextInvariant) + hasher.combine(contextType) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(derivation) + hasher.combine(description_fhir) + hasher.combine(differential) + hasher.combine(experimental) + hasher.combine(fhirVersion) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(keyword) + hasher.combine(kind) + hasher.combine(mapping) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(snapshot) + hasher.combine(status) + hasher.combine(title) + hasher.combine(type) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Differential view of the structure. + + A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies. + */ +open class StructureDefinitionDifferential: BackboneElement { + + /// Definition of elements in the resource (if no StructureDefinition) + public var element: [ElementDefinition] + + /// Designated initializer taking all required properties + public init(element: [ElementDefinition]) { + self.element = element + super.init() + } + + /// Convenience initializer + public convenience init( + element: [ElementDefinition], + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(element: element) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case element + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.element = try [ElementDefinition](from: _container, forKey: .element) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try element.encode(on: &_container, forKey: .element) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureDefinitionDifferential else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return element == _other.element + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(element) + } +} + +/** + External specification that the content is mapped to. + + An external specification that the content is mapped to. + */ +open class StructureDefinitionMapping: BackboneElement { + + /// Internal id when this mapping is used + public var identity: FHIRPrimitive + + /// Identifies what this mapping refers to + public var uri: FHIRPrimitive? + + /// Names what this mapping refers to + public var name: FHIRPrimitive? + + /// Versions, Issues, Scope limitations etc. + public var comment: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(identity: FHIRPrimitive) { + self.identity = identity + super.init() + } + + /// Convenience initializer + public convenience init( + comment: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identity: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + uri: FHIRPrimitive? = nil) + { + self.init(identity: identity) + self.comment = comment + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.name = name + self.uri = uri + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case comment; case _comment + case identity; case _identity + case name; case _name + case uri; case _uri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.comment = try FHIRPrimitive(from: _container, forKeyIfPresent: .comment, auxiliaryKey: ._comment) + self.identity = try FHIRPrimitive(from: _container, forKey: .identity, auxiliaryKey: ._identity) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.uri = try FHIRPrimitive(from: _container, forKeyIfPresent: .uri, auxiliaryKey: ._uri) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try comment?.encode(on: &_container, forKey: .comment, auxiliaryKey: ._comment) + try identity.encode(on: &_container, forKey: .identity, auxiliaryKey: ._identity) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try uri?.encode(on: &_container, forKey: .uri, auxiliaryKey: ._uri) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureDefinitionMapping else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return comment == _other.comment + && identity == _other.identity + && name == _other.name + && uri == _other.uri + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(comment) + hasher.combine(identity) + hasher.combine(name) + hasher.combine(uri) + } +} + +/** + Snapshot view of the structure. + + A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base + StructureDefinition. + */ +open class StructureDefinitionSnapshot: BackboneElement { + + /// Definition of elements in the resource (if no StructureDefinition) + public var element: [ElementDefinition] + + /// Designated initializer taking all required properties + public init(element: [ElementDefinition]) { + self.element = element + super.init() + } + + /// Convenience initializer + public convenience init( + element: [ElementDefinition], + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(element: element) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case element + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.element = try [ElementDefinition](from: _container, forKey: .element) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try element.encode(on: &_container, forKey: .element) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureDefinitionSnapshot else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return element == _other.element + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(element) + } +} diff --git a/Sources/ModelsSTU3/StructureMap.swift b/Sources/ModelsSTU3/StructureMap.swift new file mode 100644 index 0000000..ba8b78a --- /dev/null +++ b/Sources/ModelsSTU3/StructureMap.swift @@ -0,0 +1,1611 @@ +// +// StructureMap.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/StructureMap) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A Map of relationships between 2 structures that can be used to transform data. + */ +open class StructureMap: DomainResource { + + override open class var resourceType: ResourceType { return .structureMap } + + /// Logical URI to reference this structure map (globally unique) + public var url: FHIRPrimitive + + /// Additional identifier for the structure map + public var identifier: [Identifier]? + + /// Business version of the structure map + public var version: FHIRPrimitive? + + /// Name for this structure map (computer friendly) + public var name: FHIRPrimitive + + /// Name for this structure map (human friendly) + public var title: FHIRPrimitive? + + /// The status of this structure map. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the structure map + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for structure map (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Why this structure map is defined + public var purpose: FHIRPrimitive? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Structure Definition used by this map + public var structure: [StructureMapStructure]? + + /// Other maps used by this map (canonical URLs) + public var `import`: [FHIRPrimitive]? + + /// Named sections for reader convenience + public var group: [StructureMapGroup] + + /// Designated initializer taking all required properties + public init(group: [StructureMapGroup], name: FHIRPrimitive, status: FHIRPrimitive, url: FHIRPrimitive) { + self.group = group + self.name = name + self.status = status + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + group: [StructureMapGroup], + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + `import`: [FHIRPrimitive]? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + status: FHIRPrimitive, + structure: [StructureMapStructure]? = nil, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(group: group, name: name, status: status, url: url) + self.contact = contact + self.contained = contained + self.copyright = copyright + self.date = date + self.description_fhir = description_fhir + self.experimental = experimental + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.`import` = `import` + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.publisher = publisher + self.purpose = purpose + self.structure = structure + self.text = text + self.title = title + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contact + case copyright; case _copyright + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case experimental; case _experimental + case group + case identifier + case `import` = "import"; case _import = "_import" + case jurisdiction + case name; case _name + case publisher; case _publisher + case purpose; case _purpose + case status; case _status + case structure + case title; case _title + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.group = try [StructureMapGroup](from: _container, forKey: .group) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.`import` = try [FHIRPrimitive](from: _container, forKeyIfPresent: .`import`, auxiliaryKey: ._import) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.structure = try [StructureMapStructure](from: _container, forKeyIfPresent: .structure) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contact?.encode(on: &_container, forKey: .contact) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try group.encode(on: &_container, forKey: .group) + try identifier?.encode(on: &_container, forKey: .identifier) + try `import`?.encode(on: &_container, forKey: .`import`, auxiliaryKey: ._import) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try structure?.encode(on: &_container, forKey: .structure) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureMap else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contact == _other.contact + && copyright == _other.copyright + && date == _other.date + && description_fhir == _other.description_fhir + && experimental == _other.experimental + && group == _other.group + && identifier == _other.identifier + && `import` == _other.`import` + && jurisdiction == _other.jurisdiction + && name == _other.name + && publisher == _other.publisher + && purpose == _other.purpose + && status == _other.status + && structure == _other.structure + && title == _other.title + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contact) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(experimental) + hasher.combine(group) + hasher.combine(identifier) + hasher.combine(`import`) + hasher.combine(jurisdiction) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(status) + hasher.combine(structure) + hasher.combine(title) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Named sections for reader convenience. + + Organizes the mapping into managable chunks for human review/ease of maintenance. + */ +open class StructureMapGroup: BackboneElement { + + /// Human-readable label + public var name: FHIRPrimitive + + /// Another group that this group adds rules to + public var extends: FHIRPrimitive? + + /// If this is the default rule set to apply for thie source type, or this combination of types. + public var typeMode: FHIRPrimitive + + /// Additional description/explaination for group + public var documentation: FHIRPrimitive? + + /// Named instance provided when invoking the map + public var input: [StructureMapGroupInput] + + /// Transform Rule from source to target + public var rule: [StructureMapGroupRule] + + /// Designated initializer taking all required properties + public init(input: [StructureMapGroupInput], name: FHIRPrimitive, rule: [StructureMapGroupRule], typeMode: FHIRPrimitive) { + self.input = input + self.name = name + self.rule = rule + self.typeMode = typeMode + super.init() + } + + /// Convenience initializer + public convenience init( + documentation: FHIRPrimitive? = nil, + extends: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + input: [StructureMapGroupInput], + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + rule: [StructureMapGroupRule], + typeMode: FHIRPrimitive) + { + self.init(input: input, name: name, rule: rule, typeMode: typeMode) + self.documentation = documentation + self.extends = extends + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case documentation; case _documentation + case extends; case _extends + case input + case name; case _name + case rule + case typeMode; case _typeMode + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.extends = try FHIRPrimitive(from: _container, forKeyIfPresent: .extends, auxiliaryKey: ._extends) + self.input = try [StructureMapGroupInput](from: _container, forKey: .input) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.rule = try [StructureMapGroupRule](from: _container, forKey: .rule) + self.typeMode = try FHIRPrimitive(from: _container, forKey: .typeMode, auxiliaryKey: ._typeMode) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try extends?.encode(on: &_container, forKey: .extends, auxiliaryKey: ._extends) + try input.encode(on: &_container, forKey: .input) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try rule.encode(on: &_container, forKey: .rule) + try typeMode.encode(on: &_container, forKey: .typeMode, auxiliaryKey: ._typeMode) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureMapGroup else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return documentation == _other.documentation + && extends == _other.extends + && input == _other.input + && name == _other.name + && rule == _other.rule + && typeMode == _other.typeMode + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(documentation) + hasher.combine(extends) + hasher.combine(input) + hasher.combine(name) + hasher.combine(rule) + hasher.combine(typeMode) + } +} + +/** + Named instance provided when invoking the map. + + A name assigned to an instance of data. The instance must be provided when the mapping is invoked. + */ +open class StructureMapGroupInput: BackboneElement { + + /// Name for this instance of data + public var name: FHIRPrimitive + + /// Type for this instance of data + public var type: FHIRPrimitive? + + /// Mode for this instance of data. + public var mode: FHIRPrimitive + + /// Documentation for this instance of data + public var documentation: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(mode: FHIRPrimitive, name: FHIRPrimitive) { + self.mode = mode + self.name = name + super.init() + } + + /// Convenience initializer + public convenience init( + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + mode: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + type: FHIRPrimitive? = nil) + { + self.init(mode: mode, name: name) + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case documentation; case _documentation + case mode; case _mode + case name; case _name + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.mode = try FHIRPrimitive(from: _container, forKey: .mode, auxiliaryKey: ._mode) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.type = try FHIRPrimitive(from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try mode.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureMapGroupInput else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return documentation == _other.documentation + && mode == _other.mode + && name == _other.name + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(documentation) + hasher.combine(mode) + hasher.combine(name) + hasher.combine(type) + } +} + +/** + Transform Rule from source to target. + */ +open class StructureMapGroupRule: BackboneElement { + + /// Name of the rule for internal references + public var name: FHIRPrimitive + + /// Source inputs to the mapping + public var source: [StructureMapGroupRuleSource] + + /// Content to create because of this mapping rule + public var target: [StructureMapGroupRuleTarget]? + + /// Rules contained in this rule + public var rule: [StructureMapGroupRule]? + + /// Which other rules to apply in the context of this rule + public var dependent: [StructureMapGroupRuleDependent]? + + /// Documentation for this instance of data + public var documentation: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive, source: [StructureMapGroupRuleSource]) { + self.name = name + self.source = source + super.init() + } + + /// Convenience initializer + public convenience init( + dependent: [StructureMapGroupRuleDependent]? = nil, + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + rule: [StructureMapGroupRule]? = nil, + source: [StructureMapGroupRuleSource], + target: [StructureMapGroupRuleTarget]? = nil) + { + self.init(name: name, source: source) + self.dependent = dependent + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.rule = rule + self.target = target + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case dependent + case documentation; case _documentation + case name; case _name + case rule + case source + case target + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.dependent = try [StructureMapGroupRuleDependent](from: _container, forKeyIfPresent: .dependent) + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.rule = try [StructureMapGroupRule](from: _container, forKeyIfPresent: .rule) + self.source = try [StructureMapGroupRuleSource](from: _container, forKey: .source) + self.target = try [StructureMapGroupRuleTarget](from: _container, forKeyIfPresent: .target) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try dependent?.encode(on: &_container, forKey: .dependent) + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try rule?.encode(on: &_container, forKey: .rule) + try source.encode(on: &_container, forKey: .source) + try target?.encode(on: &_container, forKey: .target) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureMapGroupRule else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return dependent == _other.dependent + && documentation == _other.documentation + && name == _other.name + && rule == _other.rule + && source == _other.source + && target == _other.target + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(dependent) + hasher.combine(documentation) + hasher.combine(name) + hasher.combine(rule) + hasher.combine(source) + hasher.combine(target) + } +} + +/** + Which other rules to apply in the context of this rule. + */ +open class StructureMapGroupRuleDependent: BackboneElement { + + /// Name of a rule or group to apply + public var name: FHIRPrimitive + + /// Variable to pass to the rule or group + public var variable: [FHIRPrimitive] + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive, variable: [FHIRPrimitive]) { + self.name = name + self.variable = variable + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + variable: [FHIRPrimitive]) + { + self.init(name: name, variable: variable) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case name; case _name + case variable; case _variable + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.variable = try [FHIRPrimitive](from: _container, forKey: .variable, auxiliaryKey: ._variable) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try variable.encode(on: &_container, forKey: .variable, auxiliaryKey: ._variable) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureMapGroupRuleDependent else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return name == _other.name + && variable == _other.variable + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(name) + hasher.combine(variable) + } +} + +/** + Source inputs to the mapping. + */ +open class StructureMapGroupRuleSource: BackboneElement { + + /// All possible types for "defaultValue[x]" + public enum DefaultValueX: Hashable { + case address(Address) + case age(Age) + case annotation(Annotation) + case attachment(Attachment) + case base64Binary(FHIRPrimitive) + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case coding(Coding) + case contactPoint(ContactPoint) + case count(Count) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case distance(Distance) + case duration(Duration) + case humanName(HumanName) + case id(FHIRPrimitive) + case identifier(Identifier) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case markdown(FHIRPrimitive) + case meta(Meta) + case money(Money) + case oid(FHIRPrimitive) + case period(Period) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case reference(Reference) + case sampledData(SampledData) + case signature(Signature) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case timing(Timing) + case unsignedInt(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// Type or variable this rule applies to + public var context: FHIRPrimitive + + /// Specified minimum cardinality + public var min: FHIRPrimitive? + + /// Specified maximum cardinality (number or *) + public var max: FHIRPrimitive? + + /// Rule only applies if source has this type + public var type: FHIRPrimitive? + + /// Default value if no value exists + /// One of `defaultValue[x]` + public var defaultValue: DefaultValueX? + + /// Optional field for this source + public var element: FHIRPrimitive? + + /// How to handle the list mode for this element. + public var listMode: FHIRPrimitive? + + /// Named context for field, if a field is specified + public var variable: FHIRPrimitive? + + /// FHIRPath expression - must be true or the rule does not apply + public var condition: FHIRPrimitive? + + /// FHIRPath expression - must be true or the mapping engine throws an error instead of completing + public var check: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(context: FHIRPrimitive) { + self.context = context + super.init() + } + + /// Convenience initializer + public convenience init( + check: FHIRPrimitive? = nil, + condition: FHIRPrimitive? = nil, + context: FHIRPrimitive, + defaultValue: DefaultValueX? = nil, + element: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + listMode: FHIRPrimitive? = nil, + max: FHIRPrimitive? = nil, + min: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: FHIRPrimitive? = nil, + variable: FHIRPrimitive? = nil) + { + self.init(context: context) + self.check = check + self.condition = condition + self.defaultValue = defaultValue + self.element = element + self.`extension` = `extension` + self.id = id + self.listMode = listMode + self.max = max + self.min = min + self.modifierExtension = modifierExtension + self.type = type + self.variable = variable + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case check; case _check + case condition; case _condition + case context; case _context + case defaultValueAddress + case defaultValueAge + case defaultValueAnnotation + case defaultValueAttachment + case defaultValueBase64Binary; case _defaultValueBase64Binary + case defaultValueBoolean; case _defaultValueBoolean + case defaultValueCode; case _defaultValueCode + case defaultValueCodeableConcept + case defaultValueCoding + case defaultValueContactPoint + case defaultValueCount + case defaultValueDate; case _defaultValueDate + case defaultValueDateTime; case _defaultValueDateTime + case defaultValueDecimal; case _defaultValueDecimal + case defaultValueDistance + case defaultValueDuration + case defaultValueHumanName + case defaultValueId; case _defaultValueId + case defaultValueIdentifier + case defaultValueInstant; case _defaultValueInstant + case defaultValueInteger; case _defaultValueInteger + case defaultValueMarkdown; case _defaultValueMarkdown + case defaultValueMeta + case defaultValueMoney + case defaultValueOid; case _defaultValueOid + case defaultValuePeriod + case defaultValuePositiveInt; case _defaultValuePositiveInt + case defaultValueQuantity + case defaultValueRange + case defaultValueRatio + case defaultValueReference + case defaultValueSampledData + case defaultValueSignature + case defaultValueString; case _defaultValueString + case defaultValueTime; case _defaultValueTime + case defaultValueTiming + case defaultValueUnsignedInt; case _defaultValueUnsignedInt + case defaultValueUri; case _defaultValueUri + case element; case _element + case listMode; case _listMode + case max; case _max + case min; case _min + case type; case _type + case variable; case _variable + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.check = try FHIRPrimitive(from: _container, forKeyIfPresent: .check, auxiliaryKey: ._check) + self.condition = try FHIRPrimitive(from: _container, forKeyIfPresent: .condition, auxiliaryKey: ._condition) + self.context = try FHIRPrimitive(from: _container, forKey: .context, auxiliaryKey: ._context) + var _t_defaultValue: DefaultValueX? = nil + if let defaultValueBase64Binary = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueBase64Binary, auxiliaryKey: ._defaultValueBase64Binary) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueBase64Binary, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .base64Binary(defaultValueBase64Binary) + } + if let defaultValueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueBoolean, auxiliaryKey: ._defaultValueBoolean) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueBoolean, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .boolean(defaultValueBoolean) + } + if let defaultValueCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueCode, auxiliaryKey: ._defaultValueCode) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueCode, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .code(defaultValueCode) + } + if let defaultValueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueDate, auxiliaryKey: ._defaultValueDate) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueDate, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .date(defaultValueDate) + } + if let defaultValueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueDateTime, auxiliaryKey: ._defaultValueDateTime) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueDateTime, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .dateTime(defaultValueDateTime) + } + if let defaultValueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueDecimal, auxiliaryKey: ._defaultValueDecimal) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueDecimal, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .decimal(defaultValueDecimal) + } + if let defaultValueId = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueId, auxiliaryKey: ._defaultValueId) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueId, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .id(defaultValueId) + } + if let defaultValueInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueInstant, auxiliaryKey: ._defaultValueInstant) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueInstant, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .instant(defaultValueInstant) + } + if let defaultValueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueInteger, auxiliaryKey: ._defaultValueInteger) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueInteger, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .integer(defaultValueInteger) + } + if let defaultValueMarkdown = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueMarkdown, auxiliaryKey: ._defaultValueMarkdown) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueMarkdown, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .markdown(defaultValueMarkdown) + } + if let defaultValueOid = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueOid, auxiliaryKey: ._defaultValueOid) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueOid, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .oid(defaultValueOid) + } + if let defaultValuePositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValuePositiveInt, auxiliaryKey: ._defaultValuePositiveInt) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValuePositiveInt, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .positiveInt(defaultValuePositiveInt) + } + if let defaultValueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueString, auxiliaryKey: ._defaultValueString) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueString, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .string(defaultValueString) + } + if let defaultValueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueTime, auxiliaryKey: ._defaultValueTime) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueTime, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .time(defaultValueTime) + } + if let defaultValueUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueUnsignedInt, auxiliaryKey: ._defaultValueUnsignedInt) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueUnsignedInt, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .unsignedInt(defaultValueUnsignedInt) + } + if let defaultValueUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValueUri, auxiliaryKey: ._defaultValueUri) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueUri, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .uri(defaultValueUri) + } + if let defaultValueAddress = try Address(from: _container, forKeyIfPresent: .defaultValueAddress) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueAddress, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .address(defaultValueAddress) + } + if let defaultValueAge = try Age(from: _container, forKeyIfPresent: .defaultValueAge) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueAge, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .age(defaultValueAge) + } + if let defaultValueAnnotation = try Annotation(from: _container, forKeyIfPresent: .defaultValueAnnotation) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueAnnotation, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .annotation(defaultValueAnnotation) + } + if let defaultValueAttachment = try Attachment(from: _container, forKeyIfPresent: .defaultValueAttachment) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueAttachment, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .attachment(defaultValueAttachment) + } + if let defaultValueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .defaultValueCodeableConcept) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .codeableConcept(defaultValueCodeableConcept) + } + if let defaultValueCoding = try Coding(from: _container, forKeyIfPresent: .defaultValueCoding) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueCoding, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .coding(defaultValueCoding) + } + if let defaultValueContactPoint = try ContactPoint(from: _container, forKeyIfPresent: .defaultValueContactPoint) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueContactPoint, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .contactPoint(defaultValueContactPoint) + } + if let defaultValueCount = try Count(from: _container, forKeyIfPresent: .defaultValueCount) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueCount, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .count(defaultValueCount) + } + if let defaultValueDistance = try Distance(from: _container, forKeyIfPresent: .defaultValueDistance) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueDistance, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .distance(defaultValueDistance) + } + if let defaultValueDuration = try Duration(from: _container, forKeyIfPresent: .defaultValueDuration) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueDuration, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .duration(defaultValueDuration) + } + if let defaultValueHumanName = try HumanName(from: _container, forKeyIfPresent: .defaultValueHumanName) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueHumanName, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .humanName(defaultValueHumanName) + } + if let defaultValueIdentifier = try Identifier(from: _container, forKeyIfPresent: .defaultValueIdentifier) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueIdentifier, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .identifier(defaultValueIdentifier) + } + if let defaultValueMoney = try Money(from: _container, forKeyIfPresent: .defaultValueMoney) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueMoney, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .money(defaultValueMoney) + } + if let defaultValuePeriod = try Period(from: _container, forKeyIfPresent: .defaultValuePeriod) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValuePeriod, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .period(defaultValuePeriod) + } + if let defaultValueQuantity = try Quantity(from: _container, forKeyIfPresent: .defaultValueQuantity) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueQuantity, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .quantity(defaultValueQuantity) + } + if let defaultValueRange = try Range(from: _container, forKeyIfPresent: .defaultValueRange) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueRange, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .range(defaultValueRange) + } + if let defaultValueRatio = try Ratio(from: _container, forKeyIfPresent: .defaultValueRatio) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueRatio, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .ratio(defaultValueRatio) + } + if let defaultValueReference = try Reference(from: _container, forKeyIfPresent: .defaultValueReference) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueReference, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .reference(defaultValueReference) + } + if let defaultValueSampledData = try SampledData(from: _container, forKeyIfPresent: .defaultValueSampledData) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueSampledData, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .sampledData(defaultValueSampledData) + } + if let defaultValueSignature = try Signature(from: _container, forKeyIfPresent: .defaultValueSignature) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueSignature, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .signature(defaultValueSignature) + } + if let defaultValueTiming = try Timing(from: _container, forKeyIfPresent: .defaultValueTiming) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueTiming, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .timing(defaultValueTiming) + } + if let defaultValueMeta = try Meta(from: _container, forKeyIfPresent: .defaultValueMeta) { + if _t_defaultValue != nil { + throw DecodingError.dataCorruptedError(forKey: .defaultValueMeta, in: _container, debugDescription: "More than one value provided for \"defaultValue\"") + } + _t_defaultValue = .meta(defaultValueMeta) + } + self.defaultValue = _t_defaultValue + self.element = try FHIRPrimitive(from: _container, forKeyIfPresent: .element, auxiliaryKey: ._element) + self.listMode = try FHIRPrimitive(from: _container, forKeyIfPresent: .listMode, auxiliaryKey: ._listMode) + self.max = try FHIRPrimitive(from: _container, forKeyIfPresent: .max, auxiliaryKey: ._max) + self.min = try FHIRPrimitive(from: _container, forKeyIfPresent: .min, auxiliaryKey: ._min) + self.type = try FHIRPrimitive(from: _container, forKeyIfPresent: .type, auxiliaryKey: ._type) + self.variable = try FHIRPrimitive(from: _container, forKeyIfPresent: .variable, auxiliaryKey: ._variable) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try check?.encode(on: &_container, forKey: .check, auxiliaryKey: ._check) + try condition?.encode(on: &_container, forKey: .condition, auxiliaryKey: ._condition) + try context.encode(on: &_container, forKey: .context, auxiliaryKey: ._context) + if let _enum = defaultValue { + switch _enum { + case .base64Binary(let _value): + try _value.encode(on: &_container, forKey: .defaultValueBase64Binary, auxiliaryKey: ._defaultValueBase64Binary) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .defaultValueBoolean, auxiliaryKey: ._defaultValueBoolean) + case .code(let _value): + try _value.encode(on: &_container, forKey: .defaultValueCode, auxiliaryKey: ._defaultValueCode) + case .date(let _value): + try _value.encode(on: &_container, forKey: .defaultValueDate, auxiliaryKey: ._defaultValueDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .defaultValueDateTime, auxiliaryKey: ._defaultValueDateTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .defaultValueDecimal, auxiliaryKey: ._defaultValueDecimal) + case .id(let _value): + try _value.encode(on: &_container, forKey: .defaultValueId, auxiliaryKey: ._defaultValueId) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .defaultValueInstant, auxiliaryKey: ._defaultValueInstant) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .defaultValueInteger, auxiliaryKey: ._defaultValueInteger) + case .markdown(let _value): + try _value.encode(on: &_container, forKey: .defaultValueMarkdown, auxiliaryKey: ._defaultValueMarkdown) + case .oid(let _value): + try _value.encode(on: &_container, forKey: .defaultValueOid, auxiliaryKey: ._defaultValueOid) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .defaultValuePositiveInt, auxiliaryKey: ._defaultValuePositiveInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .defaultValueString, auxiliaryKey: ._defaultValueString) + case .time(let _value): + try _value.encode(on: &_container, forKey: .defaultValueTime, auxiliaryKey: ._defaultValueTime) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .defaultValueUnsignedInt, auxiliaryKey: ._defaultValueUnsignedInt) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .defaultValueUri, auxiliaryKey: ._defaultValueUri) + case .address(let _value): + try _value.encode(on: &_container, forKey: .defaultValueAddress) + case .age(let _value): + try _value.encode(on: &_container, forKey: .defaultValueAge) + case .annotation(let _value): + try _value.encode(on: &_container, forKey: .defaultValueAnnotation) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .defaultValueAttachment) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .defaultValueCodeableConcept) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .defaultValueCoding) + case .contactPoint(let _value): + try _value.encode(on: &_container, forKey: .defaultValueContactPoint) + case .count(let _value): + try _value.encode(on: &_container, forKey: .defaultValueCount) + case .distance(let _value): + try _value.encode(on: &_container, forKey: .defaultValueDistance) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .defaultValueDuration) + case .humanName(let _value): + try _value.encode(on: &_container, forKey: .defaultValueHumanName) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .defaultValueIdentifier) + case .money(let _value): + try _value.encode(on: &_container, forKey: .defaultValueMoney) + case .period(let _value): + try _value.encode(on: &_container, forKey: .defaultValuePeriod) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .defaultValueQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .defaultValueRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .defaultValueRatio) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .defaultValueReference) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .defaultValueSampledData) + case .signature(let _value): + try _value.encode(on: &_container, forKey: .defaultValueSignature) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .defaultValueTiming) + case .meta(let _value): + try _value.encode(on: &_container, forKey: .defaultValueMeta) + } + } + try element?.encode(on: &_container, forKey: .element, auxiliaryKey: ._element) + try listMode?.encode(on: &_container, forKey: .listMode, auxiliaryKey: ._listMode) + try max?.encode(on: &_container, forKey: .max, auxiliaryKey: ._max) + try min?.encode(on: &_container, forKey: .min, auxiliaryKey: ._min) + try type?.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try variable?.encode(on: &_container, forKey: .variable, auxiliaryKey: ._variable) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureMapGroupRuleSource else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return check == _other.check + && condition == _other.condition + && context == _other.context + && defaultValue == _other.defaultValue + && element == _other.element + && listMode == _other.listMode + && max == _other.max + && min == _other.min + && type == _other.type + && variable == _other.variable + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(check) + hasher.combine(condition) + hasher.combine(context) + hasher.combine(defaultValue) + hasher.combine(element) + hasher.combine(listMode) + hasher.combine(max) + hasher.combine(min) + hasher.combine(type) + hasher.combine(variable) + } +} + +/** + Content to create because of this mapping rule. + */ +open class StructureMapGroupRuleTarget: BackboneElement { + + /// Type or variable this rule applies to + public var context: FHIRPrimitive? + + /// How to interpret the context. + public var contextType: FHIRPrimitive? + + /// Field to create in the context + public var element: FHIRPrimitive? + + /// Named context for field, if desired, and a field is specified + public var variable: FHIRPrimitive? + + /// If field is a list, how to manage the list. + public var listMode: [FHIRPrimitive]? + + /// Internal rule reference for shared list items + public var listRuleId: FHIRPrimitive? + + /// How the data is copied / created. + public var transform: FHIRPrimitive? + + /// Parameters to the transform + public var parameter: [StructureMapGroupRuleTargetParameter]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + context: FHIRPrimitive? = nil, + contextType: FHIRPrimitive? = nil, + element: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + listMode: [FHIRPrimitive]? = nil, + listRuleId: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + parameter: [StructureMapGroupRuleTargetParameter]? = nil, + transform: FHIRPrimitive? = nil, + variable: FHIRPrimitive? = nil) + { + self.init() + self.context = context + self.contextType = contextType + self.element = element + self.`extension` = `extension` + self.id = id + self.listMode = listMode + self.listRuleId = listRuleId + self.modifierExtension = modifierExtension + self.parameter = parameter + self.transform = transform + self.variable = variable + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case context; case _context + case contextType; case _contextType + case element; case _element + case listMode; case _listMode + case listRuleId; case _listRuleId + case parameter + case transform; case _transform + case variable; case _variable + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.context = try FHIRPrimitive(from: _container, forKeyIfPresent: .context, auxiliaryKey: ._context) + self.contextType = try FHIRPrimitive(from: _container, forKeyIfPresent: .contextType, auxiliaryKey: ._contextType) + self.element = try FHIRPrimitive(from: _container, forKeyIfPresent: .element, auxiliaryKey: ._element) + self.listMode = try [FHIRPrimitive](from: _container, forKeyIfPresent: .listMode, auxiliaryKey: ._listMode) + self.listRuleId = try FHIRPrimitive(from: _container, forKeyIfPresent: .listRuleId, auxiliaryKey: ._listRuleId) + self.parameter = try [StructureMapGroupRuleTargetParameter](from: _container, forKeyIfPresent: .parameter) + self.transform = try FHIRPrimitive(from: _container, forKeyIfPresent: .transform, auxiliaryKey: ._transform) + self.variable = try FHIRPrimitive(from: _container, forKeyIfPresent: .variable, auxiliaryKey: ._variable) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try context?.encode(on: &_container, forKey: .context, auxiliaryKey: ._context) + try contextType?.encode(on: &_container, forKey: .contextType, auxiliaryKey: ._contextType) + try element?.encode(on: &_container, forKey: .element, auxiliaryKey: ._element) + try listMode?.encode(on: &_container, forKey: .listMode, auxiliaryKey: ._listMode) + try listRuleId?.encode(on: &_container, forKey: .listRuleId, auxiliaryKey: ._listRuleId) + try parameter?.encode(on: &_container, forKey: .parameter) + try transform?.encode(on: &_container, forKey: .transform, auxiliaryKey: ._transform) + try variable?.encode(on: &_container, forKey: .variable, auxiliaryKey: ._variable) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureMapGroupRuleTarget else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return context == _other.context + && contextType == _other.contextType + && element == _other.element + && listMode == _other.listMode + && listRuleId == _other.listRuleId + && parameter == _other.parameter + && transform == _other.transform + && variable == _other.variable + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(context) + hasher.combine(contextType) + hasher.combine(element) + hasher.combine(listMode) + hasher.combine(listRuleId) + hasher.combine(parameter) + hasher.combine(transform) + hasher.combine(variable) + } +} + +/** + Parameters to the transform. + */ +open class StructureMapGroupRuleTargetParameter: BackboneElement { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case boolean(FHIRPrimitive) + case decimal(FHIRPrimitive) + case id(FHIRPrimitive) + case integer(FHIRPrimitive) + case string(FHIRPrimitive) + } + + /// Parameter value - variable or literal + /// One of `value[x]` + public var value: ValueX + + /// Designated initializer taking all required properties + public init(value: ValueX) { + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + value: ValueX) + { + self.init(value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case valueBoolean; case _valueBoolean + case valueDecimal; case _valueDecimal + case valueId; case _valueId + case valueInteger; case _valueInteger + case valueString; case _valueString + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.valueBoolean) || _container.contains(CodingKeys.valueDecimal) || _container.contains(CodingKeys.valueId) || _container.contains(CodingKeys.valueInteger) || _container.contains(CodingKeys.valueString) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.valueBoolean, CodingKeys.valueDecimal, CodingKeys.valueId, CodingKeys.valueInteger, CodingKeys.valueString], debugDescription: "Must have at least one value for \"value\" but have none")) + } + + // Decode all our properties + var _t_value: ValueX? = nil + if let valueId = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueId, auxiliaryKey: ._valueId) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueId, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .id(valueId) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInteger, auxiliaryKey: ._valueInteger) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInteger, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .integer(valueInteger) + } + if let valueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDecimal, auxiliaryKey: ._valueDecimal) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDecimal, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .decimal(valueDecimal) + } + self.value = _t_value! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + + switch value { + case .id(let _value): + try _value.encode(on: &_container, forKey: .valueId, auxiliaryKey: ._valueId) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .valueInteger, auxiliaryKey: ._valueInteger) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .valueDecimal, auxiliaryKey: ._valueDecimal) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureMapGroupRuleTargetParameter else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(value) + } +} + +/** + Structure Definition used by this map. + + A structure definition used by this map. The structure definition may describe instances that are converted, or the + instances that are produced. + */ +open class StructureMapStructure: BackboneElement { + + /// Canonical URL for structure definition + public var url: FHIRPrimitive + + /// How the referenced structure is used in this mapping. + public var mode: FHIRPrimitive + + /// Name for type in this map + public var alias: FHIRPrimitive? + + /// Documentation on use of structure + public var documentation: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(mode: FHIRPrimitive, url: FHIRPrimitive) { + self.mode = mode + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + alias: FHIRPrimitive? = nil, + documentation: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + mode: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + url: FHIRPrimitive) + { + self.init(mode: mode, url: url) + self.alias = alias + self.documentation = documentation + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case alias; case _alias + case documentation; case _documentation + case mode; case _mode + case url; case _url + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.alias = try FHIRPrimitive(from: _container, forKeyIfPresent: .alias, auxiliaryKey: ._alias) + self.documentation = try FHIRPrimitive(from: _container, forKeyIfPresent: .documentation, auxiliaryKey: ._documentation) + self.mode = try FHIRPrimitive(from: _container, forKey: .mode, auxiliaryKey: ._mode) + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try alias?.encode(on: &_container, forKey: .alias, auxiliaryKey: ._alias) + try documentation?.encode(on: &_container, forKey: .documentation, auxiliaryKey: ._documentation) + try mode.encode(on: &_container, forKey: .mode, auxiliaryKey: ._mode) + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? StructureMapStructure else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return alias == _other.alias + && documentation == _other.documentation + && mode == _other.mode + && url == _other.url + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(alias) + hasher.combine(documentation) + hasher.combine(mode) + hasher.combine(url) + } +} diff --git a/Sources/ModelsSTU3/Subscription.swift b/Sources/ModelsSTU3/Subscription.swift new file mode 100644 index 0000000..67c9b1e --- /dev/null +++ b/Sources/ModelsSTU3/Subscription.swift @@ -0,0 +1,277 @@ +// +// Subscription.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Subscription) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A server push subscription criteria. + + The subscription resource is used to define a push based subscription from a server to another system. Once a + subscription is registered with the server, the server checks every resource that is created or updated, and if the + resource matches the given criteria, it sends a message on the defined "channel" so that another system is able to take + an appropriate action. + */ +open class Subscription: DomainResource { + + override open class var resourceType: ResourceType { return .subscription } + + /// The status of the subscription, which marks the server state for managing the subscription. + public var status: FHIRPrimitive + + /// Contact details for source (e.g. troubleshooting) + public var contact: [ContactPoint]? + + /// When to automatically delete the subscription + public var end: FHIRPrimitive? + + /// Description of why this subscription was created + public var reason: FHIRPrimitive + + /// Rule for server push criteria + public var criteria: FHIRPrimitive + + /// Latest error note + public var error: FHIRPrimitive? + + /// The channel on which to report matches to the criteria + public var channel: SubscriptionChannel + + /// A tag to add to matching resources + public var tag: [Coding]? + + /// Designated initializer taking all required properties + public init(channel: SubscriptionChannel, criteria: FHIRPrimitive, reason: FHIRPrimitive, status: FHIRPrimitive) { + self.channel = channel + self.criteria = criteria + self.reason = reason + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + channel: SubscriptionChannel, + contact: [ContactPoint]? = nil, + contained: [ResourceProxy]? = nil, + criteria: FHIRPrimitive, + end: FHIRPrimitive? = nil, + error: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + reason: FHIRPrimitive, + status: FHIRPrimitive, + tag: [Coding]? = nil, + text: Narrative? = nil) + { + self.init(channel: channel, criteria: criteria, reason: reason, status: status) + self.contact = contact + self.contained = contained + self.end = end + self.error = error + self.`extension` = `extension` + self.id = id + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.tag = tag + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case channel + case contact + case criteria; case _criteria + case end; case _end + case error; case _error + case reason; case _reason + case status; case _status + case tag + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.channel = try SubscriptionChannel(from: _container, forKey: .channel) + self.contact = try [ContactPoint](from: _container, forKeyIfPresent: .contact) + self.criteria = try FHIRPrimitive(from: _container, forKey: .criteria, auxiliaryKey: ._criteria) + self.end = try FHIRPrimitive(from: _container, forKeyIfPresent: .end, auxiliaryKey: ._end) + self.error = try FHIRPrimitive(from: _container, forKeyIfPresent: .error, auxiliaryKey: ._error) + self.reason = try FHIRPrimitive(from: _container, forKey: .reason, auxiliaryKey: ._reason) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.tag = try [Coding](from: _container, forKeyIfPresent: .tag) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try channel.encode(on: &_container, forKey: .channel) + try contact?.encode(on: &_container, forKey: .contact) + try criteria.encode(on: &_container, forKey: .criteria, auxiliaryKey: ._criteria) + try end?.encode(on: &_container, forKey: .end, auxiliaryKey: ._end) + try error?.encode(on: &_container, forKey: .error, auxiliaryKey: ._error) + try reason.encode(on: &_container, forKey: .reason, auxiliaryKey: ._reason) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try tag?.encode(on: &_container, forKey: .tag) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Subscription else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return channel == _other.channel + && contact == _other.contact + && criteria == _other.criteria + && end == _other.end + && error == _other.error + && reason == _other.reason + && status == _other.status + && tag == _other.tag + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(channel) + hasher.combine(contact) + hasher.combine(criteria) + hasher.combine(end) + hasher.combine(error) + hasher.combine(reason) + hasher.combine(status) + hasher.combine(tag) + } +} + +/** + The channel on which to report matches to the criteria. + + Details where to send notifications when resources are received that meet the criteria. + */ +open class SubscriptionChannel: BackboneElement { + + /// The type of channel to send notifications on. + public var type: FHIRPrimitive + + /// Where the channel points to + public var endpoint: FHIRPrimitive? + + /// Mimetype to send, or omit for no payload + public var payload: FHIRPrimitive? + + /// Usage depends on the channel type + public var header: [FHIRPrimitive]? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + endpoint: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + header: [FHIRPrimitive]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + payload: FHIRPrimitive? = nil, + type: FHIRPrimitive) + { + self.init(type: type) + self.endpoint = endpoint + self.`extension` = `extension` + self.header = header + self.id = id + self.modifierExtension = modifierExtension + self.payload = payload + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case endpoint; case _endpoint + case header; case _header + case payload; case _payload + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.endpoint = try FHIRPrimitive(from: _container, forKeyIfPresent: .endpoint, auxiliaryKey: ._endpoint) + self.header = try [FHIRPrimitive](from: _container, forKeyIfPresent: .header, auxiliaryKey: ._header) + self.payload = try FHIRPrimitive(from: _container, forKeyIfPresent: .payload, auxiliaryKey: ._payload) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try endpoint?.encode(on: &_container, forKey: .endpoint, auxiliaryKey: ._endpoint) + try header?.encode(on: &_container, forKey: .header, auxiliaryKey: ._header) + try payload?.encode(on: &_container, forKey: .payload, auxiliaryKey: ._payload) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SubscriptionChannel else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return endpoint == _other.endpoint + && header == _other.header + && payload == _other.payload + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(endpoint) + hasher.combine(header) + hasher.combine(payload) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/Substance.swift b/Sources/ModelsSTU3/Substance.swift new file mode 100644 index 0000000..f24112a --- /dev/null +++ b/Sources/ModelsSTU3/Substance.swift @@ -0,0 +1,366 @@ +// +// Substance.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Substance) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A homogeneous material with a definite composition. + */ +open class Substance: DomainResource { + + override open class var resourceType: ResourceType { return .substance } + + /// Unique identifier + public var identifier: [Identifier]? + + /// A code to indicate if the substance is actively used. + public var status: FHIRPrimitive? + + /// What class/type of substance this is + public var category: [CodeableConcept]? + + /// What substance this is + public var code: CodeableConcept + + /// Textual description of the substance, comments + public var description_fhir: FHIRPrimitive? + + /// If this describes a specific package/container of the substance + public var instance: [SubstanceInstance]? + + /// Composition information about the substance + public var ingredient: [SubstanceIngredient]? + + /// Designated initializer taking all required properties + public init(code: CodeableConcept) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + category: [CodeableConcept]? = nil, + code: CodeableConcept, + contained: [ResourceProxy]? = nil, + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + ingredient: [SubstanceIngredient]? = nil, + instance: [SubstanceInstance]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + status: FHIRPrimitive? = nil, + text: Narrative? = nil) + { + self.init(code: code) + self.category = category + self.contained = contained + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.ingredient = ingredient + self.instance = instance + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.status = status + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case category + case code + case description_fhir = "description"; case _description_fhir = "_description" + case identifier + case ingredient + case instance + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.category = try [CodeableConcept](from: _container, forKeyIfPresent: .category) + self.code = try CodeableConcept(from: _container, forKey: .code) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.ingredient = try [SubstanceIngredient](from: _container, forKeyIfPresent: .ingredient) + self.instance = try [SubstanceInstance](from: _container, forKeyIfPresent: .instance) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try category?.encode(on: &_container, forKey: .category) + try code.encode(on: &_container, forKey: .code) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try identifier?.encode(on: &_container, forKey: .identifier) + try ingredient?.encode(on: &_container, forKey: .ingredient) + try instance?.encode(on: &_container, forKey: .instance) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Substance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return category == _other.category + && code == _other.code + && description_fhir == _other.description_fhir + && identifier == _other.identifier + && ingredient == _other.ingredient + && instance == _other.instance + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(category) + hasher.combine(code) + hasher.combine(description_fhir) + hasher.combine(identifier) + hasher.combine(ingredient) + hasher.combine(instance) + hasher.combine(status) + } +} + +/** + Composition information about the substance. + + A substance can be composed of other substances. + */ +open class SubstanceIngredient: BackboneElement { + + /// All possible types for "substance[x]" + public enum SubstanceX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Optional amount (concentration) + public var quantity: Ratio? + + /// A component of the substance + /// One of `substance[x]` + public var substance: SubstanceX + + /// Designated initializer taking all required properties + public init(substance: SubstanceX) { + self.substance = substance + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + quantity: Ratio? = nil, + substance: SubstanceX) + { + self.init(substance: substance) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.quantity = quantity + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case quantity + case substanceCodeableConcept + case substanceReference + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.substanceCodeableConcept) || _container.contains(CodingKeys.substanceReference) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.substanceCodeableConcept, CodingKeys.substanceReference], debugDescription: "Must have at least one value for \"substance\" but have none")) + } + + // Decode all our properties + self.quantity = try Ratio(from: _container, forKeyIfPresent: .quantity) + var _t_substance: SubstanceX? = nil + if let substanceCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .substanceCodeableConcept) { + if _t_substance != nil { + throw DecodingError.dataCorruptedError(forKey: .substanceCodeableConcept, in: _container, debugDescription: "More than one value provided for \"substance\"") + } + _t_substance = .codeableConcept(substanceCodeableConcept) + } + if let substanceReference = try Reference(from: _container, forKeyIfPresent: .substanceReference) { + if _t_substance != nil { + throw DecodingError.dataCorruptedError(forKey: .substanceReference, in: _container, debugDescription: "More than one value provided for \"substance\"") + } + _t_substance = .reference(substanceReference) + } + self.substance = _t_substance! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try quantity?.encode(on: &_container, forKey: .quantity) + + switch substance { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .substanceCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .substanceReference) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SubstanceIngredient else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return quantity == _other.quantity + && substance == _other.substance + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(quantity) + hasher.combine(substance) + } +} + +/** + If this describes a specific package/container of the substance. + + Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance. + */ +open class SubstanceInstance: BackboneElement { + + /// Identifier of the package/container + public var identifier: Identifier? + + /// When no longer valid to use + public var expiry: FHIRPrimitive? + + /// Amount of substance in the package + public var quantity: Quantity? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + expiry: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + modifierExtension: [Extension]? = nil, + quantity: Quantity? = nil) + { + self.init() + self.expiry = expiry + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.modifierExtension = modifierExtension + self.quantity = quantity + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case expiry; case _expiry + case identifier + case quantity + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.expiry = try FHIRPrimitive(from: _container, forKeyIfPresent: .expiry, auxiliaryKey: ._expiry) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try expiry?.encode(on: &_container, forKey: .expiry, auxiliaryKey: ._expiry) + try identifier?.encode(on: &_container, forKey: .identifier) + try quantity?.encode(on: &_container, forKey: .quantity) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SubstanceInstance else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return expiry == _other.expiry + && identifier == _other.identifier + && quantity == _other.quantity + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(expiry) + hasher.combine(identifier) + hasher.combine(quantity) + } +} diff --git a/Sources/ModelsSTU3/SupplyDelivery.swift b/Sources/ModelsSTU3/SupplyDelivery.swift new file mode 100644 index 0000000..2619352 --- /dev/null +++ b/Sources/ModelsSTU3/SupplyDelivery.swift @@ -0,0 +1,350 @@ +// +// SupplyDelivery.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Delivery of bulk Supplies. + + Record of delivery of what is supplied. + */ +open class SupplyDelivery: DomainResource { + + override open class var resourceType: ResourceType { return .supplyDelivery } + + /// All possible types for "occurrence[x]" + public enum OccurrenceX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + case timing(Timing) + } + + /// External identifier + public var identifier: Identifier? + + /// Fulfills plan, proposal or order + public var basedOn: [Reference]? + + /// Part of referenced event + public var partOf: [Reference]? + + /// A code specifying the state of the dispense event. + public var status: FHIRPrimitive? + + /// Patient for whom the item is supplied + public var patient: Reference? + + /// Category of dispense event + public var type: CodeableConcept? + + /// The item that is delivered or supplied + public var suppliedItem: SupplyDeliverySuppliedItem? + + /// When event occurred + /// One of `occurrence[x]` + public var occurrence: OccurrenceX? + + /// Dispenser + public var supplier: Reference? + + /// Where the Supply was sent + public var destination: Reference? + + /// Who collected the Supply + public var receiver: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + basedOn: [Reference]? = nil, + contained: [ResourceProxy]? = nil, + destination: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + occurrence: OccurrenceX? = nil, + partOf: [Reference]? = nil, + patient: Reference? = nil, + receiver: [Reference]? = nil, + status: FHIRPrimitive? = nil, + suppliedItem: SupplyDeliverySuppliedItem? = nil, + supplier: Reference? = nil, + text: Narrative? = nil, + type: CodeableConcept? = nil) + { + self.init() + self.basedOn = basedOn + self.contained = contained + self.destination = destination + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.occurrence = occurrence + self.partOf = partOf + self.patient = patient + self.receiver = receiver + self.status = status + self.suppliedItem = suppliedItem + self.supplier = supplier + self.text = text + self.type = type + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case basedOn + case destination + case identifier + case occurrenceDateTime; case _occurrenceDateTime + case occurrencePeriod + case occurrenceTiming + case partOf + case patient + case receiver + case status; case _status + case suppliedItem + case supplier + case type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.destination = try Reference(from: _container, forKeyIfPresent: .destination) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + var _t_occurrence: OccurrenceX? = nil + if let occurrenceDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceDateTime, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .dateTime(occurrenceDateTime) + } + if let occurrencePeriod = try Period(from: _container, forKeyIfPresent: .occurrencePeriod) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrencePeriod, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .period(occurrencePeriod) + } + if let occurrenceTiming = try Timing(from: _container, forKeyIfPresent: .occurrenceTiming) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceTiming, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .timing(occurrenceTiming) + } + self.occurrence = _t_occurrence + self.partOf = try [Reference](from: _container, forKeyIfPresent: .partOf) + self.patient = try Reference(from: _container, forKeyIfPresent: .patient) + self.receiver = try [Reference](from: _container, forKeyIfPresent: .receiver) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.suppliedItem = try SupplyDeliverySuppliedItem(from: _container, forKeyIfPresent: .suppliedItem) + self.supplier = try Reference(from: _container, forKeyIfPresent: .supplier) + self.type = try CodeableConcept(from: _container, forKeyIfPresent: .type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try basedOn?.encode(on: &_container, forKey: .basedOn) + try destination?.encode(on: &_container, forKey: .destination) + try identifier?.encode(on: &_container, forKey: .identifier) + if let _enum = occurrence { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .occurrencePeriod) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .occurrenceTiming) + } + } + try partOf?.encode(on: &_container, forKey: .partOf) + try patient?.encode(on: &_container, forKey: .patient) + try receiver?.encode(on: &_container, forKey: .receiver) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try suppliedItem?.encode(on: &_container, forKey: .suppliedItem) + try supplier?.encode(on: &_container, forKey: .supplier) + try type?.encode(on: &_container, forKey: .type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SupplyDelivery else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return basedOn == _other.basedOn + && destination == _other.destination + && identifier == _other.identifier + && occurrence == _other.occurrence + && partOf == _other.partOf + && patient == _other.patient + && receiver == _other.receiver + && status == _other.status + && suppliedItem == _other.suppliedItem + && supplier == _other.supplier + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(basedOn) + hasher.combine(destination) + hasher.combine(identifier) + hasher.combine(occurrence) + hasher.combine(partOf) + hasher.combine(patient) + hasher.combine(receiver) + hasher.combine(status) + hasher.combine(suppliedItem) + hasher.combine(supplier) + hasher.combine(type) + } +} + +/** + The item that is delivered or supplied. + + The item that is being delivered or has been supplied. + */ +open class SupplyDeliverySuppliedItem: BackboneElement { + + /// All possible types for "item[x]" + public enum ItemX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Amount dispensed + public var quantity: Quantity? + + /// Medication, Substance, or Device supplied + /// One of `item[x]` + public var item: ItemX? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + item: ItemX? = nil, + modifierExtension: [Extension]? = nil, + quantity: Quantity? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.item = item + self.modifierExtension = modifierExtension + self.quantity = quantity + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case itemCodeableConcept + case itemReference + case quantity + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_item: ItemX? = nil + if let itemCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .itemCodeableConcept) { + if _t_item != nil { + throw DecodingError.dataCorruptedError(forKey: .itemCodeableConcept, in: _container, debugDescription: "More than one value provided for \"item\"") + } + _t_item = .codeableConcept(itemCodeableConcept) + } + if let itemReference = try Reference(from: _container, forKeyIfPresent: .itemReference) { + if _t_item != nil { + throw DecodingError.dataCorruptedError(forKey: .itemReference, in: _container, debugDescription: "More than one value provided for \"item\"") + } + _t_item = .reference(itemReference) + } + self.item = _t_item + self.quantity = try Quantity(from: _container, forKeyIfPresent: .quantity) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = item { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .itemCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .itemReference) + } + } + try quantity?.encode(on: &_container, forKey: .quantity) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SupplyDeliverySuppliedItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return item == _other.item + && quantity == _other.quantity + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(item) + hasher.combine(quantity) + } +} diff --git a/Sources/ModelsSTU3/SupplyRequest.swift b/Sources/ModelsSTU3/SupplyRequest.swift new file mode 100644 index 0000000..9a05c6a --- /dev/null +++ b/Sources/ModelsSTU3/SupplyRequest.swift @@ -0,0 +1,467 @@ +// +// SupplyRequest.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/SupplyRequest) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Request for a medication, substance or device. + + A record of a request for a medication, substance or device used in the healthcare setting. + */ +open class SupplyRequest: DomainResource { + + override open class var resourceType: ResourceType { return .supplyRequest } + + /// All possible types for "occurrence[x]" + public enum OccurrenceX: Hashable { + case dateTime(FHIRPrimitive) + case period(Period) + case timing(Timing) + } + + /// All possible types for "reason[x]" + public enum ReasonX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Unique identifier + public var identifier: Identifier? + + /// Status of the supply request. + public var status: FHIRPrimitive? + + /// The kind of supply (central, non-stock, etc.) + public var category: CodeableConcept? + + /// Indicates how quickly this SupplyRequest should be addressed with respect to other requests. + public var priority: FHIRPrimitive? + + /// The item being requested + public var orderedItem: SupplyRequestOrderedItem? + + /// When the request should be fulfilled + /// One of `occurrence[x]` + public var occurrence: OccurrenceX? + + /// When the request was made + public var authoredOn: FHIRPrimitive? + + /// Who/what is requesting service + public var requester: SupplyRequestRequester? + + /// Who is intended to fulfill the request + public var supplier: [Reference]? + + /// Why the supply item was requested + /// One of `reason[x]` + public var reason: ReasonX? + + /// The origin of the supply + public var deliverFrom: Reference? + + /// The destination of the supply + public var deliverTo: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + authoredOn: FHIRPrimitive? = nil, + category: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + deliverFrom: Reference? = nil, + deliverTo: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + occurrence: OccurrenceX? = nil, + orderedItem: SupplyRequestOrderedItem? = nil, + priority: FHIRPrimitive? = nil, + reason: ReasonX? = nil, + requester: SupplyRequestRequester? = nil, + status: FHIRPrimitive? = nil, + supplier: [Reference]? = nil, + text: Narrative? = nil) + { + self.init() + self.authoredOn = authoredOn + self.category = category + self.contained = contained + self.deliverFrom = deliverFrom + self.deliverTo = deliverTo + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.occurrence = occurrence + self.orderedItem = orderedItem + self.priority = priority + self.reason = reason + self.requester = requester + self.status = status + self.supplier = supplier + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authoredOn; case _authoredOn + case category + case deliverFrom + case deliverTo + case identifier + case occurrenceDateTime; case _occurrenceDateTime + case occurrencePeriod + case occurrenceTiming + case orderedItem + case priority; case _priority + case reasonCodeableConcept + case reasonReference + case requester + case status; case _status + case supplier + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.authoredOn = try FHIRPrimitive(from: _container, forKeyIfPresent: .authoredOn, auxiliaryKey: ._authoredOn) + self.category = try CodeableConcept(from: _container, forKeyIfPresent: .category) + self.deliverFrom = try Reference(from: _container, forKeyIfPresent: .deliverFrom) + self.deliverTo = try Reference(from: _container, forKeyIfPresent: .deliverTo) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + var _t_occurrence: OccurrenceX? = nil + if let occurrenceDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceDateTime, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .dateTime(occurrenceDateTime) + } + if let occurrencePeriod = try Period(from: _container, forKeyIfPresent: .occurrencePeriod) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrencePeriod, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .period(occurrencePeriod) + } + if let occurrenceTiming = try Timing(from: _container, forKeyIfPresent: .occurrenceTiming) { + if _t_occurrence != nil { + throw DecodingError.dataCorruptedError(forKey: .occurrenceTiming, in: _container, debugDescription: "More than one value provided for \"occurrence\"") + } + _t_occurrence = .timing(occurrenceTiming) + } + self.occurrence = _t_occurrence + self.orderedItem = try SupplyRequestOrderedItem(from: _container, forKeyIfPresent: .orderedItem) + self.priority = try FHIRPrimitive(from: _container, forKeyIfPresent: .priority, auxiliaryKey: ._priority) + var _t_reason: ReasonX? = nil + if let reasonCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .reasonCodeableConcept) { + if _t_reason != nil { + throw DecodingError.dataCorruptedError(forKey: .reasonCodeableConcept, in: _container, debugDescription: "More than one value provided for \"reason\"") + } + _t_reason = .codeableConcept(reasonCodeableConcept) + } + if let reasonReference = try Reference(from: _container, forKeyIfPresent: .reasonReference) { + if _t_reason != nil { + throw DecodingError.dataCorruptedError(forKey: .reasonReference, in: _container, debugDescription: "More than one value provided for \"reason\"") + } + _t_reason = .reference(reasonReference) + } + self.reason = _t_reason + self.requester = try SupplyRequestRequester(from: _container, forKeyIfPresent: .requester) + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + self.supplier = try [Reference](from: _container, forKeyIfPresent: .supplier) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authoredOn?.encode(on: &_container, forKey: .authoredOn, auxiliaryKey: ._authoredOn) + try category?.encode(on: &_container, forKey: .category) + try deliverFrom?.encode(on: &_container, forKey: .deliverFrom) + try deliverTo?.encode(on: &_container, forKey: .deliverTo) + try identifier?.encode(on: &_container, forKey: .identifier) + if let _enum = occurrence { + switch _enum { + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .occurrenceDateTime, auxiliaryKey: ._occurrenceDateTime) + case .period(let _value): + try _value.encode(on: &_container, forKey: .occurrencePeriod) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .occurrenceTiming) + } + } + try orderedItem?.encode(on: &_container, forKey: .orderedItem) + try priority?.encode(on: &_container, forKey: .priority, auxiliaryKey: ._priority) + if let _enum = reason { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .reasonCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .reasonReference) + } + } + try requester?.encode(on: &_container, forKey: .requester) + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try supplier?.encode(on: &_container, forKey: .supplier) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SupplyRequest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authoredOn == _other.authoredOn + && category == _other.category + && deliverFrom == _other.deliverFrom + && deliverTo == _other.deliverTo + && identifier == _other.identifier + && occurrence == _other.occurrence + && orderedItem == _other.orderedItem + && priority == _other.priority + && reason == _other.reason + && requester == _other.requester + && status == _other.status + && supplier == _other.supplier + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authoredOn) + hasher.combine(category) + hasher.combine(deliverFrom) + hasher.combine(deliverTo) + hasher.combine(identifier) + hasher.combine(occurrence) + hasher.combine(orderedItem) + hasher.combine(priority) + hasher.combine(reason) + hasher.combine(requester) + hasher.combine(status) + hasher.combine(supplier) + } +} + +/** + The item being requested. + */ +open class SupplyRequestOrderedItem: BackboneElement { + + /// All possible types for "item[x]" + public enum ItemX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// The requested amount of the item indicated + public var quantity: Quantity + + /// Medication, Substance, or Device requested to be supplied + /// One of `item[x]` + public var item: ItemX? + + /// Designated initializer taking all required properties + public init(quantity: Quantity) { + self.quantity = quantity + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + item: ItemX? = nil, + modifierExtension: [Extension]? = nil, + quantity: Quantity) + { + self.init(quantity: quantity) + self.`extension` = `extension` + self.id = id + self.item = item + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case itemCodeableConcept + case itemReference + case quantity + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_item: ItemX? = nil + if let itemCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .itemCodeableConcept) { + if _t_item != nil { + throw DecodingError.dataCorruptedError(forKey: .itemCodeableConcept, in: _container, debugDescription: "More than one value provided for \"item\"") + } + _t_item = .codeableConcept(itemCodeableConcept) + } + if let itemReference = try Reference(from: _container, forKeyIfPresent: .itemReference) { + if _t_item != nil { + throw DecodingError.dataCorruptedError(forKey: .itemReference, in: _container, debugDescription: "More than one value provided for \"item\"") + } + _t_item = .reference(itemReference) + } + self.item = _t_item + self.quantity = try Quantity(from: _container, forKey: .quantity) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = item { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .itemCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .itemReference) + } + } + try quantity.encode(on: &_container, forKey: .quantity) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SupplyRequestOrderedItem else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return item == _other.item + && quantity == _other.quantity + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(item) + hasher.combine(quantity) + } +} + +/** + Who/what is requesting service. + + The individual who initiated the request and has responsibility for its activation. + */ +open class SupplyRequestRequester: BackboneElement { + + /// Individual making the request + public var agent: Reference + + /// Organization agent is acting for + public var onBehalfOf: Reference? + + /// Designated initializer taking all required properties + public init(agent: Reference) { + self.agent = agent + super.init() + } + + /// Convenience initializer + public convenience init( + agent: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil) + { + self.init(agent: agent) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case agent + case onBehalfOf + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.agent = try Reference(from: _container, forKey: .agent) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try agent.encode(on: &_container, forKey: .agent) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? SupplyRequestRequester else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return agent == _other.agent + && onBehalfOf == _other.onBehalfOf + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(agent) + hasher.combine(onBehalfOf) + } +} diff --git a/Sources/ModelsSTU3/Task.swift b/Sources/ModelsSTU3/Task.swift new file mode 100644 index 0000000..5f54431 --- /dev/null +++ b/Sources/ModelsSTU3/Task.swift @@ -0,0 +1,1511 @@ +// +// Task.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Task) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A task to be performed. + */ +open class Task: DomainResource { + + override open class var resourceType: ResourceType { return .task } + + /// All possible types for "definition[x]" + public enum DefinitionX: Hashable { + case reference(Reference) + case uri(FHIRPrimitive) + } + + /// Task Instance Identifier + public var identifier: [Identifier]? + + /// Formal definition of task + /// One of `definition[x]` + public var definition: DefinitionX? + + /// Request fulfilled by this task + public var basedOn: [Reference]? + + /// Requisition or grouper id + public var groupIdentifier: Identifier? + + /// Composite task + public var partOf: [Reference]? + + /// The current status of the task. + public var status: FHIRPrimitive + + /// Reason for current status + public var statusReason: CodeableConcept? + + /// E.g. "Specimen collected", "IV prepped" + public var businessStatus: CodeableConcept? + + /// Indicates the "level" of actionability associated with the Task. I.e. Is this a proposed task, a planned task, + /// an actionable task, etc. + public var intent: FHIRPrimitive + + /// Indicates how quickly the Task should be addressed with respect to other requests. + public var priority: FHIRPrimitive? + + /// Task Type + public var code: CodeableConcept? + + /// Human-readable explanation of task + public var description_fhir: FHIRPrimitive? + + /// What task is acting on + public var focus: Reference? + + /// Beneficiary of the Task + public var `for`: Reference? + + /// Healthcare event during which this task originated + public var context: Reference? + + /// Start and end time of execution + public var executionPeriod: Period? + + /// Task Creation Date + public var authoredOn: FHIRPrimitive? + + /// Task Last Modified Date + public var lastModified: FHIRPrimitive? + + /// Who is asking for task to be done + public var requester: TaskRequester? + + /// requester | dispatcher | scheduler | performer | monitor | manager | acquirer | reviewer + public var performerType: [CodeableConcept]? + + /// Responsible individual + public var owner: Reference? + + /// Why task is needed + public var reason: CodeableConcept? + + /// Comments made about the task + public var note: [Annotation]? + + /// Key events in history of the Task + public var relevantHistory: [Reference]? + + /// Constraints on fulfillment tasks + public var restriction: TaskRestriction? + + /// Information used to perform task + public var input: [TaskInput]? + + /// Information produced as part of task + public var output: [TaskOutput]? + + /// Designated initializer taking all required properties + public init(intent: FHIRPrimitive, status: FHIRPrimitive) { + self.intent = intent + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + authoredOn: FHIRPrimitive? = nil, + basedOn: [Reference]? = nil, + businessStatus: CodeableConcept? = nil, + code: CodeableConcept? = nil, + contained: [ResourceProxy]? = nil, + context: Reference? = nil, + definition: DefinitionX? = nil, + description_fhir: FHIRPrimitive? = nil, + executionPeriod: Period? = nil, + `extension`: [Extension]? = nil, + focus: Reference? = nil, + `for`: Reference? = nil, + groupIdentifier: Identifier? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + input: [TaskInput]? = nil, + intent: FHIRPrimitive, + language: FHIRPrimitive? = nil, + lastModified: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + output: [TaskOutput]? = nil, + owner: Reference? = nil, + partOf: [Reference]? = nil, + performerType: [CodeableConcept]? = nil, + priority: FHIRPrimitive? = nil, + reason: CodeableConcept? = nil, + relevantHistory: [Reference]? = nil, + requester: TaskRequester? = nil, + restriction: TaskRestriction? = nil, + status: FHIRPrimitive, + statusReason: CodeableConcept? = nil, + text: Narrative? = nil) + { + self.init(intent: intent, status: status) + self.authoredOn = authoredOn + self.basedOn = basedOn + self.businessStatus = businessStatus + self.code = code + self.contained = contained + self.context = context + self.definition = definition + self.description_fhir = description_fhir + self.executionPeriod = executionPeriod + self.`extension` = `extension` + self.focus = focus + self.`for` = `for` + self.groupIdentifier = groupIdentifier + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.input = input + self.language = language + self.lastModified = lastModified + self.meta = meta + self.modifierExtension = modifierExtension + self.note = note + self.output = output + self.owner = owner + self.partOf = partOf + self.performerType = performerType + self.priority = priority + self.reason = reason + self.relevantHistory = relevantHistory + self.requester = requester + self.restriction = restriction + self.statusReason = statusReason + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case authoredOn; case _authoredOn + case basedOn + case businessStatus + case code + case context + case definitionReference + case definitionUri; case _definitionUri + case description_fhir = "description"; case _description_fhir = "_description" + case executionPeriod + case focus + case `for` = "for" + case groupIdentifier + case identifier + case input + case intent; case _intent + case lastModified; case _lastModified + case note + case output + case owner + case partOf + case performerType + case priority; case _priority + case reason + case relevantHistory + case requester + case restriction + case status; case _status + case statusReason + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.authoredOn = try FHIRPrimitive(from: _container, forKeyIfPresent: .authoredOn, auxiliaryKey: ._authoredOn) + self.basedOn = try [Reference](from: _container, forKeyIfPresent: .basedOn) + self.businessStatus = try CodeableConcept(from: _container, forKeyIfPresent: .businessStatus) + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.context = try Reference(from: _container, forKeyIfPresent: .context) + var _t_definition: DefinitionX? = nil + if let definitionUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .definitionUri, auxiliaryKey: ._definitionUri) { + if _t_definition != nil { + throw DecodingError.dataCorruptedError(forKey: .definitionUri, in: _container, debugDescription: "More than one value provided for \"definition\"") + } + _t_definition = .uri(definitionUri) + } + if let definitionReference = try Reference(from: _container, forKeyIfPresent: .definitionReference) { + if _t_definition != nil { + throw DecodingError.dataCorruptedError(forKey: .definitionReference, in: _container, debugDescription: "More than one value provided for \"definition\"") + } + _t_definition = .reference(definitionReference) + } + self.definition = _t_definition + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.executionPeriod = try Period(from: _container, forKeyIfPresent: .executionPeriod) + self.focus = try Reference(from: _container, forKeyIfPresent: .focus) + self.`for` = try Reference(from: _container, forKeyIfPresent: .`for`) + self.groupIdentifier = try Identifier(from: _container, forKeyIfPresent: .groupIdentifier) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.input = try [TaskInput](from: _container, forKeyIfPresent: .input) + self.intent = try FHIRPrimitive(from: _container, forKey: .intent, auxiliaryKey: ._intent) + self.lastModified = try FHIRPrimitive(from: _container, forKeyIfPresent: .lastModified, auxiliaryKey: ._lastModified) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.output = try [TaskOutput](from: _container, forKeyIfPresent: .output) + self.owner = try Reference(from: _container, forKeyIfPresent: .owner) + self.partOf = try [Reference](from: _container, forKeyIfPresent: .partOf) + self.performerType = try [CodeableConcept](from: _container, forKeyIfPresent: .performerType) + self.priority = try FHIRPrimitive(from: _container, forKeyIfPresent: .priority, auxiliaryKey: ._priority) + self.reason = try CodeableConcept(from: _container, forKeyIfPresent: .reason) + self.relevantHistory = try [Reference](from: _container, forKeyIfPresent: .relevantHistory) + self.requester = try TaskRequester(from: _container, forKeyIfPresent: .requester) + self.restriction = try TaskRestriction(from: _container, forKeyIfPresent: .restriction) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.statusReason = try CodeableConcept(from: _container, forKeyIfPresent: .statusReason) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try authoredOn?.encode(on: &_container, forKey: .authoredOn, auxiliaryKey: ._authoredOn) + try basedOn?.encode(on: &_container, forKey: .basedOn) + try businessStatus?.encode(on: &_container, forKey: .businessStatus) + try code?.encode(on: &_container, forKey: .code) + try context?.encode(on: &_container, forKey: .context) + if let _enum = definition { + switch _enum { + case .uri(let _value): + try _value.encode(on: &_container, forKey: .definitionUri, auxiliaryKey: ._definitionUri) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .definitionReference) + } + } + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try executionPeriod?.encode(on: &_container, forKey: .executionPeriod) + try focus?.encode(on: &_container, forKey: .focus) + try `for`?.encode(on: &_container, forKey: .`for`) + try groupIdentifier?.encode(on: &_container, forKey: .groupIdentifier) + try identifier?.encode(on: &_container, forKey: .identifier) + try input?.encode(on: &_container, forKey: .input) + try intent.encode(on: &_container, forKey: .intent, auxiliaryKey: ._intent) + try lastModified?.encode(on: &_container, forKey: .lastModified, auxiliaryKey: ._lastModified) + try note?.encode(on: &_container, forKey: .note) + try output?.encode(on: &_container, forKey: .output) + try owner?.encode(on: &_container, forKey: .owner) + try partOf?.encode(on: &_container, forKey: .partOf) + try performerType?.encode(on: &_container, forKey: .performerType) + try priority?.encode(on: &_container, forKey: .priority, auxiliaryKey: ._priority) + try reason?.encode(on: &_container, forKey: .reason) + try relevantHistory?.encode(on: &_container, forKey: .relevantHistory) + try requester?.encode(on: &_container, forKey: .requester) + try restriction?.encode(on: &_container, forKey: .restriction) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try statusReason?.encode(on: &_container, forKey: .statusReason) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Task else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return authoredOn == _other.authoredOn + && basedOn == _other.basedOn + && businessStatus == _other.businessStatus + && code == _other.code + && context == _other.context + && definition == _other.definition + && description_fhir == _other.description_fhir + && executionPeriod == _other.executionPeriod + && focus == _other.focus + && `for` == _other.`for` + && groupIdentifier == _other.groupIdentifier + && identifier == _other.identifier + && input == _other.input + && intent == _other.intent + && lastModified == _other.lastModified + && note == _other.note + && output == _other.output + && owner == _other.owner + && partOf == _other.partOf + && performerType == _other.performerType + && priority == _other.priority + && reason == _other.reason + && relevantHistory == _other.relevantHistory + && requester == _other.requester + && restriction == _other.restriction + && status == _other.status + && statusReason == _other.statusReason + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(authoredOn) + hasher.combine(basedOn) + hasher.combine(businessStatus) + hasher.combine(code) + hasher.combine(context) + hasher.combine(definition) + hasher.combine(description_fhir) + hasher.combine(executionPeriod) + hasher.combine(focus) + hasher.combine(`for`) + hasher.combine(groupIdentifier) + hasher.combine(identifier) + hasher.combine(input) + hasher.combine(intent) + hasher.combine(lastModified) + hasher.combine(note) + hasher.combine(output) + hasher.combine(owner) + hasher.combine(partOf) + hasher.combine(performerType) + hasher.combine(priority) + hasher.combine(reason) + hasher.combine(relevantHistory) + hasher.combine(requester) + hasher.combine(restriction) + hasher.combine(status) + hasher.combine(statusReason) + } +} + +/** + Information used to perform task. + + Additional information that may be needed in the execution of the task. + */ +open class TaskInput: BackboneElement { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case address(Address) + case age(Age) + case annotation(Annotation) + case attachment(Attachment) + case base64Binary(FHIRPrimitive) + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case coding(Coding) + case contactPoint(ContactPoint) + case count(Count) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case distance(Distance) + case duration(Duration) + case humanName(HumanName) + case id(FHIRPrimitive) + case identifier(Identifier) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case markdown(FHIRPrimitive) + case meta(Meta) + case money(Money) + case oid(FHIRPrimitive) + case period(Period) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case reference(Reference) + case sampledData(SampledData) + case signature(Signature) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case timing(Timing) + case unsignedInt(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// Label for the input + public var type: CodeableConcept + + /// Content to use in performing the task + /// One of `value[x]` + public var value: ValueX + + /// Designated initializer taking all required properties + public init(type: CodeableConcept, value: ValueX) { + self.type = type + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: CodeableConcept, + value: ValueX) + { + self.init(type: type, value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case type + case valueAddress + case valueAge + case valueAnnotation + case valueAttachment + case valueBase64Binary; case _valueBase64Binary + case valueBoolean; case _valueBoolean + case valueCode; case _valueCode + case valueCodeableConcept + case valueCoding + case valueContactPoint + case valueCount + case valueDate; case _valueDate + case valueDateTime; case _valueDateTime + case valueDecimal; case _valueDecimal + case valueDistance + case valueDuration + case valueHumanName + case valueId; case _valueId + case valueIdentifier + case valueInstant; case _valueInstant + case valueInteger; case _valueInteger + case valueMarkdown; case _valueMarkdown + case valueMeta + case valueMoney + case valueOid; case _valueOid + case valuePeriod + case valuePositiveInt; case _valuePositiveInt + case valueQuantity + case valueRange + case valueRatio + case valueReference + case valueSampledData + case valueSignature + case valueString; case _valueString + case valueTime; case _valueTime + case valueTiming + case valueUnsignedInt; case _valueUnsignedInt + case valueUri; case _valueUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.valueAddress) || _container.contains(CodingKeys.valueAge) || _container.contains(CodingKeys.valueAnnotation) || _container.contains(CodingKeys.valueAttachment) || _container.contains(CodingKeys.valueBase64Binary) || _container.contains(CodingKeys.valueBoolean) || _container.contains(CodingKeys.valueCode) || _container.contains(CodingKeys.valueCodeableConcept) || _container.contains(CodingKeys.valueCoding) || _container.contains(CodingKeys.valueContactPoint) || _container.contains(CodingKeys.valueCount) || _container.contains(CodingKeys.valueDate) || _container.contains(CodingKeys.valueDateTime) || _container.contains(CodingKeys.valueDecimal) || _container.contains(CodingKeys.valueDistance) || _container.contains(CodingKeys.valueDuration) || _container.contains(CodingKeys.valueHumanName) || _container.contains(CodingKeys.valueId) || _container.contains(CodingKeys.valueIdentifier) || _container.contains(CodingKeys.valueInstant) || _container.contains(CodingKeys.valueInteger) || _container.contains(CodingKeys.valueMarkdown) || _container.contains(CodingKeys.valueMeta) || _container.contains(CodingKeys.valueMoney) || _container.contains(CodingKeys.valueOid) || _container.contains(CodingKeys.valuePeriod) || _container.contains(CodingKeys.valuePositiveInt) || _container.contains(CodingKeys.valueQuantity) || _container.contains(CodingKeys.valueRange) || _container.contains(CodingKeys.valueRatio) || _container.contains(CodingKeys.valueReference) || _container.contains(CodingKeys.valueSampledData) || _container.contains(CodingKeys.valueSignature) || _container.contains(CodingKeys.valueString) || _container.contains(CodingKeys.valueTime) || _container.contains(CodingKeys.valueTiming) || _container.contains(CodingKeys.valueUnsignedInt) || _container.contains(CodingKeys.valueUri) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.valueAddress, CodingKeys.valueAge, CodingKeys.valueAnnotation, CodingKeys.valueAttachment, CodingKeys.valueBase64Binary, CodingKeys.valueBoolean, CodingKeys.valueCode, CodingKeys.valueCodeableConcept, CodingKeys.valueCoding, CodingKeys.valueContactPoint, CodingKeys.valueCount, CodingKeys.valueDate, CodingKeys.valueDateTime, CodingKeys.valueDecimal, CodingKeys.valueDistance, CodingKeys.valueDuration, CodingKeys.valueHumanName, CodingKeys.valueId, CodingKeys.valueIdentifier, CodingKeys.valueInstant, CodingKeys.valueInteger, CodingKeys.valueMarkdown, CodingKeys.valueMeta, CodingKeys.valueMoney, CodingKeys.valueOid, CodingKeys.valuePeriod, CodingKeys.valuePositiveInt, CodingKeys.valueQuantity, CodingKeys.valueRange, CodingKeys.valueRatio, CodingKeys.valueReference, CodingKeys.valueSampledData, CodingKeys.valueSignature, CodingKeys.valueString, CodingKeys.valueTime, CodingKeys.valueTiming, CodingKeys.valueUnsignedInt, CodingKeys.valueUri], debugDescription: "Must have at least one value for \"value\" but have none")) + } + + // Decode all our properties + self.type = try CodeableConcept(from: _container, forKey: .type) + var _t_value: ValueX? = nil + if let valueBase64Binary = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBase64Binary, auxiliaryKey: ._valueBase64Binary) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBase64Binary, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .base64Binary(valueBase64Binary) + } + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueCode, auxiliaryKey: ._valueCode) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCode, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .code(valueCode) + } + if let valueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDate, auxiliaryKey: ._valueDate) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDate, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .date(valueDate) + } + if let valueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDateTime, auxiliaryKey: ._valueDateTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDateTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .dateTime(valueDateTime) + } + if let valueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDecimal, auxiliaryKey: ._valueDecimal) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDecimal, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .decimal(valueDecimal) + } + if let valueId = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueId, auxiliaryKey: ._valueId) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueId, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .id(valueId) + } + if let valueInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInstant, auxiliaryKey: ._valueInstant) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInstant, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .instant(valueInstant) + } + if let valueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInteger, auxiliaryKey: ._valueInteger) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInteger, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .integer(valueInteger) + } + if let valueMarkdown = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueMarkdown, auxiliaryKey: ._valueMarkdown) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMarkdown, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .markdown(valueMarkdown) + } + if let valueOid = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueOid, auxiliaryKey: ._valueOid) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueOid, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .oid(valueOid) + } + if let valuePositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .valuePositiveInt, auxiliaryKey: ._valuePositiveInt) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePositiveInt, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .positiveInt(valuePositiveInt) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueTime, auxiliaryKey: ._valueTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .time(valueTime) + } + if let valueUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUnsignedInt, auxiliaryKey: ._valueUnsignedInt) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUnsignedInt, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .unsignedInt(valueUnsignedInt) + } + if let valueUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUri, auxiliaryKey: ._valueUri) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUri, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .uri(valueUri) + } + if let valueAddress = try Address(from: _container, forKeyIfPresent: .valueAddress) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAddress, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .address(valueAddress) + } + if let valueAge = try Age(from: _container, forKeyIfPresent: .valueAge) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAge, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .age(valueAge) + } + if let valueAnnotation = try Annotation(from: _container, forKeyIfPresent: .valueAnnotation) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAnnotation, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .annotation(valueAnnotation) + } + if let valueAttachment = try Attachment(from: _container, forKeyIfPresent: .valueAttachment) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAttachment, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .attachment(valueAttachment) + } + if let valueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .valueCodeableConcept) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .codeableConcept(valueCodeableConcept) + } + if let valueCoding = try Coding(from: _container, forKeyIfPresent: .valueCoding) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCoding, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .coding(valueCoding) + } + if let valueContactPoint = try ContactPoint(from: _container, forKeyIfPresent: .valueContactPoint) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueContactPoint, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .contactPoint(valueContactPoint) + } + if let valueCount = try Count(from: _container, forKeyIfPresent: .valueCount) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCount, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .count(valueCount) + } + if let valueDistance = try Distance(from: _container, forKeyIfPresent: .valueDistance) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDistance, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .distance(valueDistance) + } + if let valueDuration = try Duration(from: _container, forKeyIfPresent: .valueDuration) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDuration, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .duration(valueDuration) + } + if let valueHumanName = try HumanName(from: _container, forKeyIfPresent: .valueHumanName) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueHumanName, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .humanName(valueHumanName) + } + if let valueIdentifier = try Identifier(from: _container, forKeyIfPresent: .valueIdentifier) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueIdentifier, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .identifier(valueIdentifier) + } + if let valueMoney = try Money(from: _container, forKeyIfPresent: .valueMoney) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMoney, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .money(valueMoney) + } + if let valuePeriod = try Period(from: _container, forKeyIfPresent: .valuePeriod) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePeriod, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .period(valuePeriod) + } + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueRange = try Range(from: _container, forKeyIfPresent: .valueRange) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRange, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .range(valueRange) + } + if let valueRatio = try Ratio(from: _container, forKeyIfPresent: .valueRatio) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRatio, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .ratio(valueRatio) + } + if let valueReference = try Reference(from: _container, forKeyIfPresent: .valueReference) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueReference, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .reference(valueReference) + } + if let valueSampledData = try SampledData(from: _container, forKeyIfPresent: .valueSampledData) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSampledData, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .sampledData(valueSampledData) + } + if let valueSignature = try Signature(from: _container, forKeyIfPresent: .valueSignature) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSignature, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .signature(valueSignature) + } + if let valueTiming = try Timing(from: _container, forKeyIfPresent: .valueTiming) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTiming, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .timing(valueTiming) + } + if let valueMeta = try Meta(from: _container, forKeyIfPresent: .valueMeta) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMeta, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .meta(valueMeta) + } + self.value = _t_value! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try type.encode(on: &_container, forKey: .type) + + switch value { + case .base64Binary(let _value): + try _value.encode(on: &_container, forKey: .valueBase64Binary, auxiliaryKey: ._valueBase64Binary) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .code(let _value): + try _value.encode(on: &_container, forKey: .valueCode, auxiliaryKey: ._valueCode) + case .date(let _value): + try _value.encode(on: &_container, forKey: .valueDate, auxiliaryKey: ._valueDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .valueDateTime, auxiliaryKey: ._valueDateTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .valueDecimal, auxiliaryKey: ._valueDecimal) + case .id(let _value): + try _value.encode(on: &_container, forKey: .valueId, auxiliaryKey: ._valueId) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .valueInstant, auxiliaryKey: ._valueInstant) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .valueInteger, auxiliaryKey: ._valueInteger) + case .markdown(let _value): + try _value.encode(on: &_container, forKey: .valueMarkdown, auxiliaryKey: ._valueMarkdown) + case .oid(let _value): + try _value.encode(on: &_container, forKey: .valueOid, auxiliaryKey: ._valueOid) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .valuePositiveInt, auxiliaryKey: ._valuePositiveInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .time(let _value): + try _value.encode(on: &_container, forKey: .valueTime, auxiliaryKey: ._valueTime) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .valueUnsignedInt, auxiliaryKey: ._valueUnsignedInt) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .valueUri, auxiliaryKey: ._valueUri) + case .address(let _value): + try _value.encode(on: &_container, forKey: .valueAddress) + case .age(let _value): + try _value.encode(on: &_container, forKey: .valueAge) + case .annotation(let _value): + try _value.encode(on: &_container, forKey: .valueAnnotation) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .valueAttachment) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .valueCodeableConcept) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .valueCoding) + case .contactPoint(let _value): + try _value.encode(on: &_container, forKey: .valueContactPoint) + case .count(let _value): + try _value.encode(on: &_container, forKey: .valueCount) + case .distance(let _value): + try _value.encode(on: &_container, forKey: .valueDistance) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .valueDuration) + case .humanName(let _value): + try _value.encode(on: &_container, forKey: .valueHumanName) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .valueIdentifier) + case .money(let _value): + try _value.encode(on: &_container, forKey: .valueMoney) + case .period(let _value): + try _value.encode(on: &_container, forKey: .valuePeriod) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .valueRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .valueRatio) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueReference) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .valueSampledData) + case .signature(let _value): + try _value.encode(on: &_container, forKey: .valueSignature) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .valueTiming) + case .meta(let _value): + try _value.encode(on: &_container, forKey: .valueMeta) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TaskInput else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return type == _other.type + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(type) + hasher.combine(value) + } +} + +/** + Information produced as part of task. + + Outputs produced by the Task. + */ +open class TaskOutput: BackboneElement { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case address(Address) + case age(Age) + case annotation(Annotation) + case attachment(Attachment) + case base64Binary(FHIRPrimitive) + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case codeableConcept(CodeableConcept) + case coding(Coding) + case contactPoint(ContactPoint) + case count(Count) + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case decimal(FHIRPrimitive) + case distance(Distance) + case duration(Duration) + case humanName(HumanName) + case id(FHIRPrimitive) + case identifier(Identifier) + case instant(FHIRPrimitive) + case integer(FHIRPrimitive) + case markdown(FHIRPrimitive) + case meta(Meta) + case money(Money) + case oid(FHIRPrimitive) + case period(Period) + case positiveInt(FHIRPrimitive) + case quantity(Quantity) + case range(Range) + case ratio(Ratio) + case reference(Reference) + case sampledData(SampledData) + case signature(Signature) + case string(FHIRPrimitive) + case time(FHIRPrimitive) + case timing(Timing) + case unsignedInt(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// Label for output + public var type: CodeableConcept + + /// Result of output + /// One of `value[x]` + public var value: ValueX + + /// Designated initializer taking all required properties + public init(type: CodeableConcept, value: ValueX) { + self.type = type + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: CodeableConcept, + value: ValueX) + { + self.init(type: type, value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case type + case valueAddress + case valueAge + case valueAnnotation + case valueAttachment + case valueBase64Binary; case _valueBase64Binary + case valueBoolean; case _valueBoolean + case valueCode; case _valueCode + case valueCodeableConcept + case valueCoding + case valueContactPoint + case valueCount + case valueDate; case _valueDate + case valueDateTime; case _valueDateTime + case valueDecimal; case _valueDecimal + case valueDistance + case valueDuration + case valueHumanName + case valueId; case _valueId + case valueIdentifier + case valueInstant; case _valueInstant + case valueInteger; case _valueInteger + case valueMarkdown; case _valueMarkdown + case valueMeta + case valueMoney + case valueOid; case _valueOid + case valuePeriod + case valuePositiveInt; case _valuePositiveInt + case valueQuantity + case valueRange + case valueRatio + case valueReference + case valueSampledData + case valueSignature + case valueString; case _valueString + case valueTime; case _valueTime + case valueTiming + case valueUnsignedInt; case _valueUnsignedInt + case valueUri; case _valueUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.valueAddress) || _container.contains(CodingKeys.valueAge) || _container.contains(CodingKeys.valueAnnotation) || _container.contains(CodingKeys.valueAttachment) || _container.contains(CodingKeys.valueBase64Binary) || _container.contains(CodingKeys.valueBoolean) || _container.contains(CodingKeys.valueCode) || _container.contains(CodingKeys.valueCodeableConcept) || _container.contains(CodingKeys.valueCoding) || _container.contains(CodingKeys.valueContactPoint) || _container.contains(CodingKeys.valueCount) || _container.contains(CodingKeys.valueDate) || _container.contains(CodingKeys.valueDateTime) || _container.contains(CodingKeys.valueDecimal) || _container.contains(CodingKeys.valueDistance) || _container.contains(CodingKeys.valueDuration) || _container.contains(CodingKeys.valueHumanName) || _container.contains(CodingKeys.valueId) || _container.contains(CodingKeys.valueIdentifier) || _container.contains(CodingKeys.valueInstant) || _container.contains(CodingKeys.valueInteger) || _container.contains(CodingKeys.valueMarkdown) || _container.contains(CodingKeys.valueMeta) || _container.contains(CodingKeys.valueMoney) || _container.contains(CodingKeys.valueOid) || _container.contains(CodingKeys.valuePeriod) || _container.contains(CodingKeys.valuePositiveInt) || _container.contains(CodingKeys.valueQuantity) || _container.contains(CodingKeys.valueRange) || _container.contains(CodingKeys.valueRatio) || _container.contains(CodingKeys.valueReference) || _container.contains(CodingKeys.valueSampledData) || _container.contains(CodingKeys.valueSignature) || _container.contains(CodingKeys.valueString) || _container.contains(CodingKeys.valueTime) || _container.contains(CodingKeys.valueTiming) || _container.contains(CodingKeys.valueUnsignedInt) || _container.contains(CodingKeys.valueUri) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.valueAddress, CodingKeys.valueAge, CodingKeys.valueAnnotation, CodingKeys.valueAttachment, CodingKeys.valueBase64Binary, CodingKeys.valueBoolean, CodingKeys.valueCode, CodingKeys.valueCodeableConcept, CodingKeys.valueCoding, CodingKeys.valueContactPoint, CodingKeys.valueCount, CodingKeys.valueDate, CodingKeys.valueDateTime, CodingKeys.valueDecimal, CodingKeys.valueDistance, CodingKeys.valueDuration, CodingKeys.valueHumanName, CodingKeys.valueId, CodingKeys.valueIdentifier, CodingKeys.valueInstant, CodingKeys.valueInteger, CodingKeys.valueMarkdown, CodingKeys.valueMeta, CodingKeys.valueMoney, CodingKeys.valueOid, CodingKeys.valuePeriod, CodingKeys.valuePositiveInt, CodingKeys.valueQuantity, CodingKeys.valueRange, CodingKeys.valueRatio, CodingKeys.valueReference, CodingKeys.valueSampledData, CodingKeys.valueSignature, CodingKeys.valueString, CodingKeys.valueTime, CodingKeys.valueTiming, CodingKeys.valueUnsignedInt, CodingKeys.valueUri], debugDescription: "Must have at least one value for \"value\" but have none")) + } + + // Decode all our properties + self.type = try CodeableConcept(from: _container, forKey: .type) + var _t_value: ValueX? = nil + if let valueBase64Binary = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBase64Binary, auxiliaryKey: ._valueBase64Binary) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBase64Binary, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .base64Binary(valueBase64Binary) + } + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueCode, auxiliaryKey: ._valueCode) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCode, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .code(valueCode) + } + if let valueDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDate, auxiliaryKey: ._valueDate) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDate, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .date(valueDate) + } + if let valueDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDateTime, auxiliaryKey: ._valueDateTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDateTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .dateTime(valueDateTime) + } + if let valueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDecimal, auxiliaryKey: ._valueDecimal) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDecimal, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .decimal(valueDecimal) + } + if let valueId = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueId, auxiliaryKey: ._valueId) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueId, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .id(valueId) + } + if let valueInstant = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInstant, auxiliaryKey: ._valueInstant) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInstant, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .instant(valueInstant) + } + if let valueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInteger, auxiliaryKey: ._valueInteger) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInteger, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .integer(valueInteger) + } + if let valueMarkdown = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueMarkdown, auxiliaryKey: ._valueMarkdown) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMarkdown, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .markdown(valueMarkdown) + } + if let valueOid = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueOid, auxiliaryKey: ._valueOid) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueOid, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .oid(valueOid) + } + if let valuePositiveInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .valuePositiveInt, auxiliaryKey: ._valuePositiveInt) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePositiveInt, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .positiveInt(valuePositiveInt) + } + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueTime, auxiliaryKey: ._valueTime) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTime, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .time(valueTime) + } + if let valueUnsignedInt = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUnsignedInt, auxiliaryKey: ._valueUnsignedInt) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUnsignedInt, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .unsignedInt(valueUnsignedInt) + } + if let valueUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUri, auxiliaryKey: ._valueUri) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUri, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .uri(valueUri) + } + if let valueAddress = try Address(from: _container, forKeyIfPresent: .valueAddress) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAddress, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .address(valueAddress) + } + if let valueAge = try Age(from: _container, forKeyIfPresent: .valueAge) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAge, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .age(valueAge) + } + if let valueAnnotation = try Annotation(from: _container, forKeyIfPresent: .valueAnnotation) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAnnotation, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .annotation(valueAnnotation) + } + if let valueAttachment = try Attachment(from: _container, forKeyIfPresent: .valueAttachment) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueAttachment, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .attachment(valueAttachment) + } + if let valueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .valueCodeableConcept) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .codeableConcept(valueCodeableConcept) + } + if let valueCoding = try Coding(from: _container, forKeyIfPresent: .valueCoding) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCoding, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .coding(valueCoding) + } + if let valueContactPoint = try ContactPoint(from: _container, forKeyIfPresent: .valueContactPoint) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueContactPoint, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .contactPoint(valueContactPoint) + } + if let valueCount = try Count(from: _container, forKeyIfPresent: .valueCount) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCount, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .count(valueCount) + } + if let valueDistance = try Distance(from: _container, forKeyIfPresent: .valueDistance) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDistance, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .distance(valueDistance) + } + if let valueDuration = try Duration(from: _container, forKeyIfPresent: .valueDuration) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDuration, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .duration(valueDuration) + } + if let valueHumanName = try HumanName(from: _container, forKeyIfPresent: .valueHumanName) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueHumanName, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .humanName(valueHumanName) + } + if let valueIdentifier = try Identifier(from: _container, forKeyIfPresent: .valueIdentifier) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueIdentifier, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .identifier(valueIdentifier) + } + if let valueMoney = try Money(from: _container, forKeyIfPresent: .valueMoney) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMoney, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .money(valueMoney) + } + if let valuePeriod = try Period(from: _container, forKeyIfPresent: .valuePeriod) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valuePeriod, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .period(valuePeriod) + } + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueRange = try Range(from: _container, forKeyIfPresent: .valueRange) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRange, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .range(valueRange) + } + if let valueRatio = try Ratio(from: _container, forKeyIfPresent: .valueRatio) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRatio, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .ratio(valueRatio) + } + if let valueReference = try Reference(from: _container, forKeyIfPresent: .valueReference) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueReference, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .reference(valueReference) + } + if let valueSampledData = try SampledData(from: _container, forKeyIfPresent: .valueSampledData) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSampledData, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .sampledData(valueSampledData) + } + if let valueSignature = try Signature(from: _container, forKeyIfPresent: .valueSignature) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueSignature, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .signature(valueSignature) + } + if let valueTiming = try Timing(from: _container, forKeyIfPresent: .valueTiming) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueTiming, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .timing(valueTiming) + } + if let valueMeta = try Meta(from: _container, forKeyIfPresent: .valueMeta) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueMeta, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .meta(valueMeta) + } + self.value = _t_value! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try type.encode(on: &_container, forKey: .type) + + switch value { + case .base64Binary(let _value): + try _value.encode(on: &_container, forKey: .valueBase64Binary, auxiliaryKey: ._valueBase64Binary) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .code(let _value): + try _value.encode(on: &_container, forKey: .valueCode, auxiliaryKey: ._valueCode) + case .date(let _value): + try _value.encode(on: &_container, forKey: .valueDate, auxiliaryKey: ._valueDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .valueDateTime, auxiliaryKey: ._valueDateTime) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .valueDecimal, auxiliaryKey: ._valueDecimal) + case .id(let _value): + try _value.encode(on: &_container, forKey: .valueId, auxiliaryKey: ._valueId) + case .instant(let _value): + try _value.encode(on: &_container, forKey: .valueInstant, auxiliaryKey: ._valueInstant) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .valueInteger, auxiliaryKey: ._valueInteger) + case .markdown(let _value): + try _value.encode(on: &_container, forKey: .valueMarkdown, auxiliaryKey: ._valueMarkdown) + case .oid(let _value): + try _value.encode(on: &_container, forKey: .valueOid, auxiliaryKey: ._valueOid) + case .positiveInt(let _value): + try _value.encode(on: &_container, forKey: .valuePositiveInt, auxiliaryKey: ._valuePositiveInt) + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .time(let _value): + try _value.encode(on: &_container, forKey: .valueTime, auxiliaryKey: ._valueTime) + case .unsignedInt(let _value): + try _value.encode(on: &_container, forKey: .valueUnsignedInt, auxiliaryKey: ._valueUnsignedInt) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .valueUri, auxiliaryKey: ._valueUri) + case .address(let _value): + try _value.encode(on: &_container, forKey: .valueAddress) + case .age(let _value): + try _value.encode(on: &_container, forKey: .valueAge) + case .annotation(let _value): + try _value.encode(on: &_container, forKey: .valueAnnotation) + case .attachment(let _value): + try _value.encode(on: &_container, forKey: .valueAttachment) + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .valueCodeableConcept) + case .coding(let _value): + try _value.encode(on: &_container, forKey: .valueCoding) + case .contactPoint(let _value): + try _value.encode(on: &_container, forKey: .valueContactPoint) + case .count(let _value): + try _value.encode(on: &_container, forKey: .valueCount) + case .distance(let _value): + try _value.encode(on: &_container, forKey: .valueDistance) + case .duration(let _value): + try _value.encode(on: &_container, forKey: .valueDuration) + case .humanName(let _value): + try _value.encode(on: &_container, forKey: .valueHumanName) + case .identifier(let _value): + try _value.encode(on: &_container, forKey: .valueIdentifier) + case .money(let _value): + try _value.encode(on: &_container, forKey: .valueMoney) + case .period(let _value): + try _value.encode(on: &_container, forKey: .valuePeriod) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .valueRange) + case .ratio(let _value): + try _value.encode(on: &_container, forKey: .valueRatio) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .valueReference) + case .sampledData(let _value): + try _value.encode(on: &_container, forKey: .valueSampledData) + case .signature(let _value): + try _value.encode(on: &_container, forKey: .valueSignature) + case .timing(let _value): + try _value.encode(on: &_container, forKey: .valueTiming) + case .meta(let _value): + try _value.encode(on: &_container, forKey: .valueMeta) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TaskOutput else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return type == _other.type + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(type) + hasher.combine(value) + } +} + +/** + Who is asking for task to be done. + + The creator of the task. + */ +open class TaskRequester: BackboneElement { + + /// Individual asking for task + public var agent: Reference + + /// Organization individual is acting for + public var onBehalfOf: Reference? + + /// Designated initializer taking all required properties + public init(agent: Reference) { + self.agent = agent + super.init() + } + + /// Convenience initializer + public convenience init( + agent: Reference, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + onBehalfOf: Reference? = nil) + { + self.init(agent: agent) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.onBehalfOf = onBehalfOf + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case agent + case onBehalfOf + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.agent = try Reference(from: _container, forKey: .agent) + self.onBehalfOf = try Reference(from: _container, forKeyIfPresent: .onBehalfOf) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try agent.encode(on: &_container, forKey: .agent) + try onBehalfOf?.encode(on: &_container, forKey: .onBehalfOf) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TaskRequester else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return agent == _other.agent + && onBehalfOf == _other.onBehalfOf + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(agent) + hasher.combine(onBehalfOf) + } +} + +/** + Constraints on fulfillment tasks. + + If the Task.focus is a request resource and the task is seeking fulfillment (i.e is asking for the request to be + actioned), this element identifies any limitations on what parts of the referenced request should be actioned. + */ +open class TaskRestriction: BackboneElement { + + /// How many times to repeat + public var repetitions: FHIRPrimitive? + + /// When fulfillment sought + public var period: Period? + + /// For whom is fulfillment sought? + public var recipient: [Reference]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + period: Period? = nil, + recipient: [Reference]? = nil, + repetitions: FHIRPrimitive? = nil) + { + self.init() + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.period = period + self.recipient = recipient + self.repetitions = repetitions + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case period + case recipient + case repetitions; case _repetitions + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.period = try Period(from: _container, forKeyIfPresent: .period) + self.recipient = try [Reference](from: _container, forKeyIfPresent: .recipient) + self.repetitions = try FHIRPrimitive(from: _container, forKeyIfPresent: .repetitions, auxiliaryKey: ._repetitions) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try period?.encode(on: &_container, forKey: .period) + try recipient?.encode(on: &_container, forKey: .recipient) + try repetitions?.encode(on: &_container, forKey: .repetitions, auxiliaryKey: ._repetitions) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TaskRestriction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return period == _other.period + && recipient == _other.recipient + && repetitions == _other.repetitions + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(period) + hasher.combine(recipient) + hasher.combine(repetitions) + } +} diff --git a/Sources/ModelsSTU3/TestReport.swift b/Sources/ModelsSTU3/TestReport.swift new file mode 100644 index 0000000..ae1e953 --- /dev/null +++ b/Sources/ModelsSTU3/TestReport.swift @@ -0,0 +1,947 @@ +// +// TestReport.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/TestReport) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Describes the results of a TestScript execution. + + A summary of information based on the results of executing a TestScript. + */ +open class TestReport: DomainResource { + + override open class var resourceType: ResourceType { return .testReport } + + /// External identifier + public var identifier: Identifier? + + /// Informal name of the executed TestScript + public var name: FHIRPrimitive? + + /// The current state of this test report. + public var status: FHIRPrimitive + + /// Reference to the version-specific TestScript that was executed to produce this TestReport + public var testScript: Reference + + /// The overall result from the execution of the TestScript. + public var result: FHIRPrimitive + + /// The final score (percentage of tests passed) resulting from the execution of the TestScript + public var score: FHIRPrimitive? + + /// Name of the tester producing this report (Organization or individual) + public var tester: FHIRPrimitive? + + /// When the TestScript was executed and this TestReport was generated + public var issued: FHIRPrimitive? + + /// A participant in the test execution, either the execution engine, a client, or a server + public var participant: [TestReportParticipant]? + + /// The results of the series of required setup operations before the tests were executed + public var setup: TestReportSetup? + + /// A test executed from the test script + public var test: [TestReportTest]? + + /// The results of running the series of required clean up steps + public var teardown: TestReportTeardown? + + /// Designated initializer taking all required properties + public init(result: FHIRPrimitive, status: FHIRPrimitive, testScript: Reference) { + self.result = result + self.status = status + self.testScript = testScript + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + issued: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + participant: [TestReportParticipant]? = nil, + result: FHIRPrimitive, + score: FHIRPrimitive? = nil, + setup: TestReportSetup? = nil, + status: FHIRPrimitive, + teardown: TestReportTeardown? = nil, + test: [TestReportTest]? = nil, + testScript: Reference, + tester: FHIRPrimitive? = nil, + text: Narrative? = nil) + { + self.init(result: result, status: status, testScript: testScript) + self.contained = contained + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.issued = issued + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.participant = participant + self.score = score + self.setup = setup + self.teardown = teardown + self.test = test + self.tester = tester + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case identifier + case issued; case _issued + case name; case _name + case participant + case result; case _result + case score; case _score + case setup + case status; case _status + case teardown + case test + case testScript + case tester; case _tester + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.issued = try FHIRPrimitive(from: _container, forKeyIfPresent: .issued, auxiliaryKey: ._issued) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.participant = try [TestReportParticipant](from: _container, forKeyIfPresent: .participant) + self.result = try FHIRPrimitive(from: _container, forKey: .result, auxiliaryKey: ._result) + self.score = try FHIRPrimitive(from: _container, forKeyIfPresent: .score, auxiliaryKey: ._score) + self.setup = try TestReportSetup(from: _container, forKeyIfPresent: .setup) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.teardown = try TestReportTeardown(from: _container, forKeyIfPresent: .teardown) + self.test = try [TestReportTest](from: _container, forKeyIfPresent: .test) + self.testScript = try Reference(from: _container, forKey: .testScript) + self.tester = try FHIRPrimitive(from: _container, forKeyIfPresent: .tester, auxiliaryKey: ._tester) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try identifier?.encode(on: &_container, forKey: .identifier) + try issued?.encode(on: &_container, forKey: .issued, auxiliaryKey: ._issued) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try participant?.encode(on: &_container, forKey: .participant) + try result.encode(on: &_container, forKey: .result, auxiliaryKey: ._result) + try score?.encode(on: &_container, forKey: .score, auxiliaryKey: ._score) + try setup?.encode(on: &_container, forKey: .setup) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try teardown?.encode(on: &_container, forKey: .teardown) + try test?.encode(on: &_container, forKey: .test) + try testScript.encode(on: &_container, forKey: .testScript) + try tester?.encode(on: &_container, forKey: .tester, auxiliaryKey: ._tester) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestReport else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return identifier == _other.identifier + && issued == _other.issued + && name == _other.name + && participant == _other.participant + && result == _other.result + && score == _other.score + && setup == _other.setup + && status == _other.status + && teardown == _other.teardown + && test == _other.test + && testScript == _other.testScript + && tester == _other.tester + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(identifier) + hasher.combine(issued) + hasher.combine(name) + hasher.combine(participant) + hasher.combine(result) + hasher.combine(score) + hasher.combine(setup) + hasher.combine(status) + hasher.combine(teardown) + hasher.combine(test) + hasher.combine(testScript) + hasher.combine(tester) + } +} + +/** + A participant in the test execution, either the execution engine, a client, or a server. + */ +open class TestReportParticipant: BackboneElement { + + /// The type of participant. + public var type: FHIRPrimitive + + /// The uri of the participant. An absolute URL is preferred + public var uri: FHIRPrimitive + + /// The display name of the participant + public var display: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive, uri: FHIRPrimitive) { + self.type = type + self.uri = uri + super.init() + } + + /// Convenience initializer + public convenience init( + display: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + type: FHIRPrimitive, + uri: FHIRPrimitive) + { + self.init(type: type, uri: uri) + self.display = display + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case display; case _display + case type; case _type + case uri; case _uri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + self.uri = try FHIRPrimitive(from: _container, forKey: .uri, auxiliaryKey: ._uri) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try uri.encode(on: &_container, forKey: .uri, auxiliaryKey: ._uri) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestReportParticipant else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return display == _other.display + && type == _other.type + && uri == _other.uri + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(display) + hasher.combine(type) + hasher.combine(uri) + } +} + +/** + The results of the series of required setup operations before the tests were executed. + */ +open class TestReportSetup: BackboneElement { + + /// A setup operation or assert that was executed + public var action: [TestReportSetupAction] + + /// Designated initializer taking all required properties + public init(action: [TestReportSetupAction]) { + self.action = action + super.init() + } + + /// Convenience initializer + public convenience init( + action: [TestReportSetupAction], + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(action: action) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [TestReportSetupAction](from: _container, forKey: .action) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action.encode(on: &_container, forKey: .action) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestReportSetup else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + } +} + +/** + A setup operation or assert that was executed. + + Action would contain either an operation or an assertion. + */ +open class TestReportSetupAction: BackboneElement { + + /// The operation to perform + public var operation: TestReportSetupActionOperation? + + /// The assertion to perform + public var assert: TestReportSetupActionAssert? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + assert: TestReportSetupActionAssert? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + operation: TestReportSetupActionOperation? = nil) + { + self.init() + self.assert = assert + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.operation = operation + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case assert + case operation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.assert = try TestReportSetupActionAssert(from: _container, forKeyIfPresent: .assert) + self.operation = try TestReportSetupActionOperation(from: _container, forKeyIfPresent: .operation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try assert?.encode(on: &_container, forKey: .assert) + try operation?.encode(on: &_container, forKey: .operation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestReportSetupAction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return assert == _other.assert + && operation == _other.operation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(assert) + hasher.combine(operation) + } +} + +/** + The assertion to perform. + + The results of the assertion performed on the previous operations. + */ +open class TestReportSetupActionAssert: BackboneElement { + + /// The result of this assertion. + public var result: FHIRPrimitive + + /// A message associated with the result + public var message: FHIRPrimitive? + + /// A link to further details on the result + public var detail: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(result: FHIRPrimitive) { + self.result = result + super.init() + } + + /// Convenience initializer + public convenience init( + detail: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + message: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + result: FHIRPrimitive) + { + self.init(result: result) + self.detail = detail + self.`extension` = `extension` + self.id = id + self.message = message + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case detail; case _detail + case message; case _message + case result; case _result + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.detail = try FHIRPrimitive(from: _container, forKeyIfPresent: .detail, auxiliaryKey: ._detail) + self.message = try FHIRPrimitive(from: _container, forKeyIfPresent: .message, auxiliaryKey: ._message) + self.result = try FHIRPrimitive(from: _container, forKey: .result, auxiliaryKey: ._result) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try detail?.encode(on: &_container, forKey: .detail, auxiliaryKey: ._detail) + try message?.encode(on: &_container, forKey: .message, auxiliaryKey: ._message) + try result.encode(on: &_container, forKey: .result, auxiliaryKey: ._result) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestReportSetupActionAssert else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return detail == _other.detail + && message == _other.message + && result == _other.result + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(detail) + hasher.combine(message) + hasher.combine(result) + } +} + +/** + The operation to perform. + + The operation performed. + */ +open class TestReportSetupActionOperation: BackboneElement { + + /// The result of this operation. + public var result: FHIRPrimitive + + /// A message associated with the result + public var message: FHIRPrimitive? + + /// A link to further details on the result + public var detail: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(result: FHIRPrimitive) { + self.result = result + super.init() + } + + /// Convenience initializer + public convenience init( + detail: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + message: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + result: FHIRPrimitive) + { + self.init(result: result) + self.detail = detail + self.`extension` = `extension` + self.id = id + self.message = message + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case detail; case _detail + case message; case _message + case result; case _result + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.detail = try FHIRPrimitive(from: _container, forKeyIfPresent: .detail, auxiliaryKey: ._detail) + self.message = try FHIRPrimitive(from: _container, forKeyIfPresent: .message, auxiliaryKey: ._message) + self.result = try FHIRPrimitive(from: _container, forKey: .result, auxiliaryKey: ._result) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try detail?.encode(on: &_container, forKey: .detail, auxiliaryKey: ._detail) + try message?.encode(on: &_container, forKey: .message, auxiliaryKey: ._message) + try result.encode(on: &_container, forKey: .result, auxiliaryKey: ._result) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestReportSetupActionOperation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return detail == _other.detail + && message == _other.message + && result == _other.result + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(detail) + hasher.combine(message) + hasher.combine(result) + } +} + +/** + The results of running the series of required clean up steps. + + The results of the series of operations required to clean up after the all the tests were executed (successfully or + otherwise). + */ +open class TestReportTeardown: BackboneElement { + + /// One or more teardown operations performed + public var action: [TestReportTeardownAction] + + /// Designated initializer taking all required properties + public init(action: [TestReportTeardownAction]) { + self.action = action + super.init() + } + + /// Convenience initializer + public convenience init( + action: [TestReportTeardownAction], + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(action: action) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [TestReportTeardownAction](from: _container, forKey: .action) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action.encode(on: &_container, forKey: .action) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestReportTeardown else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + } +} + +/** + One or more teardown operations performed. + + The teardown action will only contain an operation. + */ +open class TestReportTeardownAction: BackboneElement { + + /// The teardown operation performed + public var operation: TestReportSetupActionOperation + + /// Designated initializer taking all required properties + public init(operation: TestReportSetupActionOperation) { + self.operation = operation + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + operation: TestReportSetupActionOperation) + { + self.init(operation: operation) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case operation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.operation = try TestReportSetupActionOperation(from: _container, forKey: .operation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try operation.encode(on: &_container, forKey: .operation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestReportTeardownAction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return operation == _other.operation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(operation) + } +} + +/** + A test executed from the test script. + */ +open class TestReportTest: BackboneElement { + + /// Tracking/logging name of this test + public var name: FHIRPrimitive? + + /// Tracking/reporting short description of the test + public var description_fhir: FHIRPrimitive? + + /// A test operation or assert that was performed + public var action: [TestReportTestAction] + + /// Designated initializer taking all required properties + public init(action: [TestReportTestAction]) { + self.action = action + super.init() + } + + /// Convenience initializer + public convenience init( + action: [TestReportTestAction], + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil) + { + self.init(action: action) + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.name = name + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case description_fhir = "description"; case _description_fhir = "_description" + case name; case _name + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [TestReportTestAction](from: _container, forKey: .action) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action.encode(on: &_container, forKey: .action) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestReportTest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && description_fhir == _other.description_fhir + && name == _other.name + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(description_fhir) + hasher.combine(name) + } +} + +/** + A test operation or assert that was performed. + + Action would contain either an operation or an assertion. + */ +open class TestReportTestAction: BackboneElement { + + /// The operation performed + public var operation: TestReportSetupActionOperation? + + /// The assertion performed + public var assert: TestReportSetupActionAssert? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + assert: TestReportSetupActionAssert? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + operation: TestReportSetupActionOperation? = nil) + { + self.init() + self.assert = assert + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.operation = operation + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case assert + case operation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.assert = try TestReportSetupActionAssert(from: _container, forKeyIfPresent: .assert) + self.operation = try TestReportSetupActionOperation(from: _container, forKeyIfPresent: .operation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try assert?.encode(on: &_container, forKey: .assert) + try operation?.encode(on: &_container, forKey: .operation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestReportTestAction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return assert == _other.assert + && operation == _other.operation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(assert) + hasher.combine(operation) + } +} diff --git a/Sources/ModelsSTU3/TestScript.swift b/Sources/ModelsSTU3/TestScript.swift new file mode 100644 index 0000000..9e95599 --- /dev/null +++ b/Sources/ModelsSTU3/TestScript.swift @@ -0,0 +1,2916 @@ +// +// TestScript.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/TestScript) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Describes a set of tests. + + A structured set of tests against a FHIR server implementation to determine compliance against the FHIR specification. + */ +open class TestScript: DomainResource { + + override open class var resourceType: ResourceType { return .testScript } + + /// Logical URI to reference this test script (globally unique) + public var url: FHIRPrimitive + + /// Additional identifier for the test script + public var identifier: Identifier? + + /// Business version of the test script + public var version: FHIRPrimitive? + + /// Name for this test script (computer friendly) + public var name: FHIRPrimitive + + /// Name for this test script (human friendly) + public var title: FHIRPrimitive? + + /// The status of this test script. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the test script + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for test script (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Why this test script is defined + public var purpose: FHIRPrimitive? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// An abstract server representing a client or sender in a message exchange + public var origin: [TestScriptOrigin]? + + /// An abstract server representing a destination or receiver in a message exchange + public var destination: [TestScriptDestination]? + + /// Required capability that is assumed to function correctly on the FHIR server being tested + public var metadata: TestScriptMetadata? + + /// Fixture in the test script - by reference (uri) + public var fixture: [TestScriptFixture]? + + /// Reference of the validation profile + public var profile: [Reference]? + + /// Placeholder for evaluated elements + public var variable: [TestScriptVariable]? + + /// Assert rule used within the test script + public var rule: [TestScriptRule]? + + /// Assert ruleset used within the test script + public var ruleset: [TestScriptRuleset]? + + /// A series of required setup operations before tests are executed + public var setup: TestScriptSetup? + + /// A test in this script + public var test: [TestScriptTest]? + + /// A series of required clean up steps + public var teardown: TestScriptTeardown? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive, status: FHIRPrimitive, url: FHIRPrimitive) { + self.name = name + self.status = status + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + destination: [TestScriptDestination]? = nil, + experimental: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + fixture: [TestScriptFixture]? = nil, + id: FHIRPrimitive? = nil, + identifier: Identifier? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + metadata: TestScriptMetadata? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + origin: [TestScriptOrigin]? = nil, + profile: [Reference]? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + rule: [TestScriptRule]? = nil, + ruleset: [TestScriptRuleset]? = nil, + setup: TestScriptSetup? = nil, + status: FHIRPrimitive, + teardown: TestScriptTeardown? = nil, + test: [TestScriptTest]? = nil, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive, + useContext: [UsageContext]? = nil, + variable: [TestScriptVariable]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(name: name, status: status, url: url) + self.contact = contact + self.contained = contained + self.copyright = copyright + self.date = date + self.description_fhir = description_fhir + self.destination = destination + self.experimental = experimental + self.`extension` = `extension` + self.fixture = fixture + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.metadata = metadata + self.modifierExtension = modifierExtension + self.origin = origin + self.profile = profile + self.publisher = publisher + self.purpose = purpose + self.rule = rule + self.ruleset = ruleset + self.setup = setup + self.teardown = teardown + self.test = test + self.text = text + self.title = title + self.useContext = useContext + self.variable = variable + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contact + case copyright; case _copyright + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case destination + case experimental; case _experimental + case fixture + case identifier + case jurisdiction + case metadata + case name; case _name + case origin + case profile + case publisher; case _publisher + case purpose; case _purpose + case rule + case ruleset + case setup + case status; case _status + case teardown + case test + case title; case _title + case url; case _url + case useContext + case variable + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.destination = try [TestScriptDestination](from: _container, forKeyIfPresent: .destination) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.fixture = try [TestScriptFixture](from: _container, forKeyIfPresent: .fixture) + self.identifier = try Identifier(from: _container, forKeyIfPresent: .identifier) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.metadata = try TestScriptMetadata(from: _container, forKeyIfPresent: .metadata) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.origin = try [TestScriptOrigin](from: _container, forKeyIfPresent: .origin) + self.profile = try [Reference](from: _container, forKeyIfPresent: .profile) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.rule = try [TestScriptRule](from: _container, forKeyIfPresent: .rule) + self.ruleset = try [TestScriptRuleset](from: _container, forKeyIfPresent: .ruleset) + self.setup = try TestScriptSetup(from: _container, forKeyIfPresent: .setup) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.teardown = try TestScriptTeardown(from: _container, forKeyIfPresent: .teardown) + self.test = try [TestScriptTest](from: _container, forKeyIfPresent: .test) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.variable = try [TestScriptVariable](from: _container, forKeyIfPresent: .variable) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contact?.encode(on: &_container, forKey: .contact) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try destination?.encode(on: &_container, forKey: .destination) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try fixture?.encode(on: &_container, forKey: .fixture) + try identifier?.encode(on: &_container, forKey: .identifier) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try metadata?.encode(on: &_container, forKey: .metadata) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try origin?.encode(on: &_container, forKey: .origin) + try profile?.encode(on: &_container, forKey: .profile) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try rule?.encode(on: &_container, forKey: .rule) + try ruleset?.encode(on: &_container, forKey: .ruleset) + try setup?.encode(on: &_container, forKey: .setup) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try teardown?.encode(on: &_container, forKey: .teardown) + try test?.encode(on: &_container, forKey: .test) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try variable?.encode(on: &_container, forKey: .variable) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScript else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contact == _other.contact + && copyright == _other.copyright + && date == _other.date + && description_fhir == _other.description_fhir + && destination == _other.destination + && experimental == _other.experimental + && fixture == _other.fixture + && identifier == _other.identifier + && jurisdiction == _other.jurisdiction + && metadata == _other.metadata + && name == _other.name + && origin == _other.origin + && profile == _other.profile + && publisher == _other.publisher + && purpose == _other.purpose + && rule == _other.rule + && ruleset == _other.ruleset + && setup == _other.setup + && status == _other.status + && teardown == _other.teardown + && test == _other.test + && title == _other.title + && url == _other.url + && useContext == _other.useContext + && variable == _other.variable + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contact) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(destination) + hasher.combine(experimental) + hasher.combine(fixture) + hasher.combine(identifier) + hasher.combine(jurisdiction) + hasher.combine(metadata) + hasher.combine(name) + hasher.combine(origin) + hasher.combine(profile) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(rule) + hasher.combine(ruleset) + hasher.combine(setup) + hasher.combine(status) + hasher.combine(teardown) + hasher.combine(test) + hasher.combine(title) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(variable) + hasher.combine(version) + } +} + +/** + An abstract server representing a destination or receiver in a message exchange. + + An abstract server used in operations within this test script in the destination element. + */ +open class TestScriptDestination: BackboneElement { + + /// The index of the abstract destination server starting at 1 + public var index: FHIRPrimitive + + /// FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor + public var profile: Coding + + /// Designated initializer taking all required properties + public init(index: FHIRPrimitive, profile: Coding) { + self.index = index + self.profile = profile + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + index: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + profile: Coding) + { + self.init(index: index, profile: profile) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case index; case _index + case profile + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.index = try FHIRPrimitive(from: _container, forKey: .index, auxiliaryKey: ._index) + self.profile = try Coding(from: _container, forKey: .profile) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try index.encode(on: &_container, forKey: .index, auxiliaryKey: ._index) + try profile.encode(on: &_container, forKey: .profile) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptDestination else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return index == _other.index + && profile == _other.profile + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(index) + hasher.combine(profile) + } +} + +/** + Fixture in the test script - by reference (uri). + + Fixture in the test script - by reference (uri). All fixtures are required for the test script to execute. + */ +open class TestScriptFixture: BackboneElement { + + /// Whether or not to implicitly create the fixture during setup + public var autocreate: FHIRPrimitive? + + /// Whether or not to implicitly delete the fixture during teardown + public var autodelete: FHIRPrimitive? + + /// Reference of the resource + public var resource: Reference? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + autocreate: FHIRPrimitive? = nil, + autodelete: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + resource: Reference? = nil) + { + self.init() + self.autocreate = autocreate + self.autodelete = autodelete + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.resource = resource + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case autocreate; case _autocreate + case autodelete; case _autodelete + case resource + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.autocreate = try FHIRPrimitive(from: _container, forKeyIfPresent: .autocreate, auxiliaryKey: ._autocreate) + self.autodelete = try FHIRPrimitive(from: _container, forKeyIfPresent: .autodelete, auxiliaryKey: ._autodelete) + self.resource = try Reference(from: _container, forKeyIfPresent: .resource) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try autocreate?.encode(on: &_container, forKey: .autocreate, auxiliaryKey: ._autocreate) + try autodelete?.encode(on: &_container, forKey: .autodelete, auxiliaryKey: ._autodelete) + try resource?.encode(on: &_container, forKey: .resource) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptFixture else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return autocreate == _other.autocreate + && autodelete == _other.autodelete + && resource == _other.resource + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(autocreate) + hasher.combine(autodelete) + hasher.combine(resource) + } +} + +/** + Required capability that is assumed to function correctly on the FHIR server being tested. + + The required capability must exist and are assumed to function correctly on the FHIR server being tested. + */ +open class TestScriptMetadata: BackboneElement { + + /// Links to the FHIR specification + public var link: [TestScriptMetadataLink]? + + /// Capabilities that are assumed to function correctly on the FHIR server being tested + public var capability: [TestScriptMetadataCapability] + + /// Designated initializer taking all required properties + public init(capability: [TestScriptMetadataCapability]) { + self.capability = capability + super.init() + } + + /// Convenience initializer + public convenience init( + capability: [TestScriptMetadataCapability], + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + link: [TestScriptMetadataLink]? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(capability: capability) + self.`extension` = `extension` + self.id = id + self.link = link + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case capability + case link + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.capability = try [TestScriptMetadataCapability](from: _container, forKey: .capability) + self.link = try [TestScriptMetadataLink](from: _container, forKeyIfPresent: .link) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try capability.encode(on: &_container, forKey: .capability) + try link?.encode(on: &_container, forKey: .link) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptMetadata else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return capability == _other.capability + && link == _other.link + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(capability) + hasher.combine(link) + } +} + +/** + Capabilities that are assumed to function correctly on the FHIR server being tested. + + Capabilities that must exist and are assumed to function correctly on the FHIR server being tested. + */ +open class TestScriptMetadataCapability: BackboneElement { + + /// Are the capabilities required? + public var required: FHIRPrimitive? + + /// Are the capabilities validated? + public var validated: FHIRPrimitive? + + /// The expected capabilities of the server + public var description_fhir: FHIRPrimitive? + + /// Which origin server these requirements apply to + public var origin: [FHIRPrimitive]? + + /// Which server these requirements apply to + public var destination: FHIRPrimitive? + + /// Links to the FHIR specification + public var link: [FHIRPrimitive]? + + /// Required Capability Statement + public var capabilities: Reference + + /// Designated initializer taking all required properties + public init(capabilities: Reference) { + self.capabilities = capabilities + super.init() + } + + /// Convenience initializer + public convenience init( + capabilities: Reference, + description_fhir: FHIRPrimitive? = nil, + destination: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + link: [FHIRPrimitive]? = nil, + modifierExtension: [Extension]? = nil, + origin: [FHIRPrimitive]? = nil, + required: FHIRPrimitive? = nil, + validated: FHIRPrimitive? = nil) + { + self.init(capabilities: capabilities) + self.description_fhir = description_fhir + self.destination = destination + self.`extension` = `extension` + self.id = id + self.link = link + self.modifierExtension = modifierExtension + self.origin = origin + self.required = required + self.validated = validated + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case capabilities + case description_fhir = "description"; case _description_fhir = "_description" + case destination; case _destination + case link; case _link + case origin; case _origin + case required; case _required + case validated; case _validated + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.capabilities = try Reference(from: _container, forKey: .capabilities) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.destination = try FHIRPrimitive(from: _container, forKeyIfPresent: .destination, auxiliaryKey: ._destination) + self.link = try [FHIRPrimitive](from: _container, forKeyIfPresent: .link, auxiliaryKey: ._link) + self.origin = try [FHIRPrimitive](from: _container, forKeyIfPresent: .origin, auxiliaryKey: ._origin) + self.required = try FHIRPrimitive(from: _container, forKeyIfPresent: .required, auxiliaryKey: ._required) + self.validated = try FHIRPrimitive(from: _container, forKeyIfPresent: .validated, auxiliaryKey: ._validated) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try capabilities.encode(on: &_container, forKey: .capabilities) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try destination?.encode(on: &_container, forKey: .destination, auxiliaryKey: ._destination) + try link?.encode(on: &_container, forKey: .link, auxiliaryKey: ._link) + try origin?.encode(on: &_container, forKey: .origin, auxiliaryKey: ._origin) + try required?.encode(on: &_container, forKey: .required, auxiliaryKey: ._required) + try validated?.encode(on: &_container, forKey: .validated, auxiliaryKey: ._validated) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptMetadataCapability else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return capabilities == _other.capabilities + && description_fhir == _other.description_fhir + && destination == _other.destination + && link == _other.link + && origin == _other.origin + && required == _other.required + && validated == _other.validated + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(capabilities) + hasher.combine(description_fhir) + hasher.combine(destination) + hasher.combine(link) + hasher.combine(origin) + hasher.combine(required) + hasher.combine(validated) + } +} + +/** + Links to the FHIR specification. + + A link to the FHIR specification that this test is covering. + */ +open class TestScriptMetadataLink: BackboneElement { + + /// URL to the specification + public var url: FHIRPrimitive + + /// Short description + public var description_fhir: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(url: FHIRPrimitive) { + self.url = url + super.init() + } + + /// Convenience initializer + public convenience init( + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + url: FHIRPrimitive) + { + self.init(url: url) + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case description_fhir = "description"; case _description_fhir = "_description" + case url; case _url + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.url = try FHIRPrimitive(from: _container, forKey: .url, auxiliaryKey: ._url) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try url.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptMetadataLink else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return description_fhir == _other.description_fhir + && url == _other.url + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(description_fhir) + hasher.combine(url) + } +} + +/** + An abstract server representing a client or sender in a message exchange. + + An abstract server used in operations within this test script in the origin element. + */ +open class TestScriptOrigin: BackboneElement { + + /// The index of the abstract origin server starting at 1 + public var index: FHIRPrimitive + + /// FHIR-Client | FHIR-SDC-FormFiller + public var profile: Coding + + /// Designated initializer taking all required properties + public init(index: FHIRPrimitive, profile: Coding) { + self.index = index + self.profile = profile + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + index: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + profile: Coding) + { + self.init(index: index, profile: profile) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case index; case _index + case profile + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.index = try FHIRPrimitive(from: _container, forKey: .index, auxiliaryKey: ._index) + self.profile = try Coding(from: _container, forKey: .profile) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try index.encode(on: &_container, forKey: .index, auxiliaryKey: ._index) + try profile.encode(on: &_container, forKey: .profile) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptOrigin else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return index == _other.index + && profile == _other.profile + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(index) + hasher.combine(profile) + } +} + +/** + Assert rule used within the test script. + + Assert rule to be used in one or more asserts within the test script. + */ +open class TestScriptRule: BackboneElement { + + /// Assert rule resource reference + public var resource: Reference + + /// Rule parameter template + public var param: [TestScriptRuleParam]? + + /// Designated initializer taking all required properties + public init(resource: Reference) { + self.resource = resource + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + param: [TestScriptRuleParam]? = nil, + resource: Reference) + { + self.init(resource: resource) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.param = param + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case param + case resource + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.param = try [TestScriptRuleParam](from: _container, forKeyIfPresent: .param) + self.resource = try Reference(from: _container, forKey: .resource) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try param?.encode(on: &_container, forKey: .param) + try resource.encode(on: &_container, forKey: .resource) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptRule else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return param == _other.param + && resource == _other.resource + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(param) + hasher.combine(resource) + } +} + +/** + Rule parameter template. + + Each rule template can take one or more parameters for rule evaluation. + */ +open class TestScriptRuleParam: BackboneElement { + + /// Parameter name matching external assert rule parameter + public var name: FHIRPrimitive + + /// Parameter value defined either explicitly or dynamically + public var value: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive) { + self.name = name + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + value: FHIRPrimitive? = nil) + { + self.init(name: name) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case name; case _name + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.value = try FHIRPrimitive(from: _container, forKeyIfPresent: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try value?.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptRuleParam else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return name == _other.name + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(name) + hasher.combine(value) + } +} + +/** + Assert ruleset used within the test script. + + Contains one or more rules. Offers a way to group rules so assertions could reference the group of rules and have them + all applied. + */ +open class TestScriptRuleset: BackboneElement { + + /// Assert ruleset resource reference + public var resource: Reference + + /// The referenced rule within the ruleset + public var rule: [TestScriptRulesetRule] + + /// Designated initializer taking all required properties + public init(resource: Reference, rule: [TestScriptRulesetRule]) { + self.resource = resource + self.rule = rule + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + resource: Reference, + rule: [TestScriptRulesetRule]) + { + self.init(resource: resource, rule: rule) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case resource + case rule + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.resource = try Reference(from: _container, forKey: .resource) + self.rule = try [TestScriptRulesetRule](from: _container, forKey: .rule) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try resource.encode(on: &_container, forKey: .resource) + try rule.encode(on: &_container, forKey: .rule) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptRuleset else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return resource == _other.resource + && rule == _other.rule + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(resource) + hasher.combine(rule) + } +} + +/** + The referenced rule within the ruleset. + + The referenced rule within the external ruleset template. + */ +open class TestScriptRulesetRule: BackboneElement { + + /// Id of referenced rule within the ruleset + public var ruleId: FHIRPrimitive + + /// Ruleset rule parameter template + public var param: [TestScriptRulesetRuleParam]? + + /// Designated initializer taking all required properties + public init(ruleId: FHIRPrimitive) { + self.ruleId = ruleId + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + param: [TestScriptRulesetRuleParam]? = nil, + ruleId: FHIRPrimitive) + { + self.init(ruleId: ruleId) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.param = param + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case param + case ruleId; case _ruleId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.param = try [TestScriptRulesetRuleParam](from: _container, forKeyIfPresent: .param) + self.ruleId = try FHIRPrimitive(from: _container, forKey: .ruleId, auxiliaryKey: ._ruleId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try param?.encode(on: &_container, forKey: .param) + try ruleId.encode(on: &_container, forKey: .ruleId, auxiliaryKey: ._ruleId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptRulesetRule else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return param == _other.param + && ruleId == _other.ruleId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(param) + hasher.combine(ruleId) + } +} + +/** + Ruleset rule parameter template. + + Each rule template can take one or more parameters for rule evaluation. + */ +open class TestScriptRulesetRuleParam: BackboneElement { + + /// Parameter name matching external assert ruleset rule parameter + public var name: FHIRPrimitive + + /// Parameter value defined either explicitly or dynamically + public var value: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive) { + self.name = name + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + value: FHIRPrimitive? = nil) + { + self.init(name: name) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case name; case _name + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.value = try FHIRPrimitive(from: _container, forKeyIfPresent: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try value?.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptRulesetRuleParam else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return name == _other.name + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(name) + hasher.combine(value) + } +} + +/** + A series of required setup operations before tests are executed. + */ +open class TestScriptSetup: BackboneElement { + + /// A setup operation or assert to perform + public var action: [TestScriptSetupAction] + + /// Designated initializer taking all required properties + public init(action: [TestScriptSetupAction]) { + self.action = action + super.init() + } + + /// Convenience initializer + public convenience init( + action: [TestScriptSetupAction], + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(action: action) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [TestScriptSetupAction](from: _container, forKey: .action) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action.encode(on: &_container, forKey: .action) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptSetup else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + } +} + +/** + A setup operation or assert to perform. + + Action would contain either an operation or an assertion. + */ +open class TestScriptSetupAction: BackboneElement { + + /// The setup operation to perform + public var operation: TestScriptSetupActionOperation? + + /// The assertion to perform + public var assert: TestScriptSetupActionAssert? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + assert: TestScriptSetupActionAssert? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + operation: TestScriptSetupActionOperation? = nil) + { + self.init() + self.assert = assert + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.operation = operation + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case assert + case operation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.assert = try TestScriptSetupActionAssert(from: _container, forKeyIfPresent: .assert) + self.operation = try TestScriptSetupActionOperation(from: _container, forKeyIfPresent: .operation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try assert?.encode(on: &_container, forKey: .assert) + try operation?.encode(on: &_container, forKey: .operation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptSetupAction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return assert == _other.assert + && operation == _other.operation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(assert) + hasher.combine(operation) + } +} + +/** + The assertion to perform. + + Evaluates the results of previous operations to determine if the server under test behaves appropriately. + */ +open class TestScriptSetupActionAssert: BackboneElement { + + /// Tracking/logging assertion label + public var label: FHIRPrimitive? + + /// Tracking/reporting assertion description + public var description_fhir: FHIRPrimitive? + + /// The direction to use for the assertion. + public var direction: FHIRPrimitive? + + /// Id of the source fixture to be evaluated + public var compareToSourceId: FHIRPrimitive? + + /// The fluentpath expression to evaluate against the source fixture + public var compareToSourceExpression: FHIRPrimitive? + + /// XPath or JSONPath expression to evaluate against the source fixture + public var compareToSourcePath: FHIRPrimitive? + + /// The content-type or mime-type to use for RESTful operation in the 'Content-Type' header. + public var contentType: FHIRPrimitive? + + /// The fluentpath expression to be evaluated + public var expression: FHIRPrimitive? + + /// HTTP header field name + public var headerField: FHIRPrimitive? + + /// Fixture Id of minimum content resource + public var minimumId: FHIRPrimitive? + + /// Perform validation on navigation links? + public var navigationLinks: FHIRPrimitive? + + /// The operator type defines the conditional behavior of the assert. If not defined, the default is equals. + public var `operator`: FHIRPrimitive? + + /// XPath or JSONPath expression + public var path: FHIRPrimitive? + + /// The request method or HTTP operation code to compare against that used by the client system under test. + public var requestMethod: FHIRPrimitive? + + /// Request URL comparison value + public var requestURL: FHIRPrimitive? + + /// Resource type + public var resource: FHIRPrimitive? + + /// None + public var response: FHIRPrimitive? + + /// HTTP response code to test + public var responseCode: FHIRPrimitive? + + /// The reference to a TestScript.rule + public var rule: TestScriptSetupActionAssertRule? + + /// The reference to a TestScript.ruleset + public var ruleset: TestScriptSetupActionAssertRuleset? + + /// Fixture Id of source expression or headerField + public var sourceId: FHIRPrimitive? + + /// Profile Id of validation profile reference + public var validateProfileId: FHIRPrimitive? + + /// The value to compare to + public var value: FHIRPrimitive? + + /// Will this assert produce a warning only on error? + public var warningOnly: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + compareToSourceExpression: FHIRPrimitive? = nil, + compareToSourceId: FHIRPrimitive? = nil, + compareToSourcePath: FHIRPrimitive? = nil, + contentType: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + direction: FHIRPrimitive? = nil, + expression: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + headerField: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + label: FHIRPrimitive? = nil, + minimumId: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + navigationLinks: FHIRPrimitive? = nil, + `operator`: FHIRPrimitive? = nil, + path: FHIRPrimitive? = nil, + requestMethod: FHIRPrimitive? = nil, + requestURL: FHIRPrimitive? = nil, + resource: FHIRPrimitive? = nil, + response: FHIRPrimitive? = nil, + responseCode: FHIRPrimitive? = nil, + rule: TestScriptSetupActionAssertRule? = nil, + ruleset: TestScriptSetupActionAssertRuleset? = nil, + sourceId: FHIRPrimitive? = nil, + validateProfileId: FHIRPrimitive? = nil, + value: FHIRPrimitive? = nil, + warningOnly: FHIRPrimitive? = nil) + { + self.init() + self.compareToSourceExpression = compareToSourceExpression + self.compareToSourceId = compareToSourceId + self.compareToSourcePath = compareToSourcePath + self.contentType = contentType + self.description_fhir = description_fhir + self.direction = direction + self.expression = expression + self.`extension` = `extension` + self.headerField = headerField + self.id = id + self.label = label + self.minimumId = minimumId + self.modifierExtension = modifierExtension + self.navigationLinks = navigationLinks + self.`operator` = `operator` + self.path = path + self.requestMethod = requestMethod + self.requestURL = requestURL + self.resource = resource + self.response = response + self.responseCode = responseCode + self.rule = rule + self.ruleset = ruleset + self.sourceId = sourceId + self.validateProfileId = validateProfileId + self.value = value + self.warningOnly = warningOnly + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case compareToSourceExpression; case _compareToSourceExpression + case compareToSourceId; case _compareToSourceId + case compareToSourcePath; case _compareToSourcePath + case contentType; case _contentType + case description_fhir = "description"; case _description_fhir = "_description" + case direction; case _direction + case expression; case _expression + case headerField; case _headerField + case label; case _label + case minimumId; case _minimumId + case navigationLinks; case _navigationLinks + case `operator` = "operator"; case _operator = "_operator" + case path; case _path + case requestMethod; case _requestMethod + case requestURL; case _requestURL + case resource; case _resource + case response; case _response + case responseCode; case _responseCode + case rule + case ruleset + case sourceId; case _sourceId + case validateProfileId; case _validateProfileId + case value; case _value + case warningOnly; case _warningOnly + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.compareToSourceExpression = try FHIRPrimitive(from: _container, forKeyIfPresent: .compareToSourceExpression, auxiliaryKey: ._compareToSourceExpression) + self.compareToSourceId = try FHIRPrimitive(from: _container, forKeyIfPresent: .compareToSourceId, auxiliaryKey: ._compareToSourceId) + self.compareToSourcePath = try FHIRPrimitive(from: _container, forKeyIfPresent: .compareToSourcePath, auxiliaryKey: ._compareToSourcePath) + self.contentType = try FHIRPrimitive(from: _container, forKeyIfPresent: .contentType, auxiliaryKey: ._contentType) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.direction = try FHIRPrimitive(from: _container, forKeyIfPresent: .direction, auxiliaryKey: ._direction) + self.expression = try FHIRPrimitive(from: _container, forKeyIfPresent: .expression, auxiliaryKey: ._expression) + self.headerField = try FHIRPrimitive(from: _container, forKeyIfPresent: .headerField, auxiliaryKey: ._headerField) + self.label = try FHIRPrimitive(from: _container, forKeyIfPresent: .label, auxiliaryKey: ._label) + self.minimumId = try FHIRPrimitive(from: _container, forKeyIfPresent: .minimumId, auxiliaryKey: ._minimumId) + self.navigationLinks = try FHIRPrimitive(from: _container, forKeyIfPresent: .navigationLinks, auxiliaryKey: ._navigationLinks) + self.`operator` = try FHIRPrimitive(from: _container, forKeyIfPresent: .`operator`, auxiliaryKey: ._operator) + self.path = try FHIRPrimitive(from: _container, forKeyIfPresent: .path, auxiliaryKey: ._path) + self.requestMethod = try FHIRPrimitive(from: _container, forKeyIfPresent: .requestMethod, auxiliaryKey: ._requestMethod) + self.requestURL = try FHIRPrimitive(from: _container, forKeyIfPresent: .requestURL, auxiliaryKey: ._requestURL) + self.resource = try FHIRPrimitive(from: _container, forKeyIfPresent: .resource, auxiliaryKey: ._resource) + self.response = try FHIRPrimitive(from: _container, forKeyIfPresent: .response, auxiliaryKey: ._response) + self.responseCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .responseCode, auxiliaryKey: ._responseCode) + self.rule = try TestScriptSetupActionAssertRule(from: _container, forKeyIfPresent: .rule) + self.ruleset = try TestScriptSetupActionAssertRuleset(from: _container, forKeyIfPresent: .ruleset) + self.sourceId = try FHIRPrimitive(from: _container, forKeyIfPresent: .sourceId, auxiliaryKey: ._sourceId) + self.validateProfileId = try FHIRPrimitive(from: _container, forKeyIfPresent: .validateProfileId, auxiliaryKey: ._validateProfileId) + self.value = try FHIRPrimitive(from: _container, forKeyIfPresent: .value, auxiliaryKey: ._value) + self.warningOnly = try FHIRPrimitive(from: _container, forKeyIfPresent: .warningOnly, auxiliaryKey: ._warningOnly) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try compareToSourceExpression?.encode(on: &_container, forKey: .compareToSourceExpression, auxiliaryKey: ._compareToSourceExpression) + try compareToSourceId?.encode(on: &_container, forKey: .compareToSourceId, auxiliaryKey: ._compareToSourceId) + try compareToSourcePath?.encode(on: &_container, forKey: .compareToSourcePath, auxiliaryKey: ._compareToSourcePath) + try contentType?.encode(on: &_container, forKey: .contentType, auxiliaryKey: ._contentType) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try direction?.encode(on: &_container, forKey: .direction, auxiliaryKey: ._direction) + try expression?.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try headerField?.encode(on: &_container, forKey: .headerField, auxiliaryKey: ._headerField) + try label?.encode(on: &_container, forKey: .label, auxiliaryKey: ._label) + try minimumId?.encode(on: &_container, forKey: .minimumId, auxiliaryKey: ._minimumId) + try navigationLinks?.encode(on: &_container, forKey: .navigationLinks, auxiliaryKey: ._navigationLinks) + try `operator`?.encode(on: &_container, forKey: .`operator`, auxiliaryKey: ._operator) + try path?.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + try requestMethod?.encode(on: &_container, forKey: .requestMethod, auxiliaryKey: ._requestMethod) + try requestURL?.encode(on: &_container, forKey: .requestURL, auxiliaryKey: ._requestURL) + try resource?.encode(on: &_container, forKey: .resource, auxiliaryKey: ._resource) + try response?.encode(on: &_container, forKey: .response, auxiliaryKey: ._response) + try responseCode?.encode(on: &_container, forKey: .responseCode, auxiliaryKey: ._responseCode) + try rule?.encode(on: &_container, forKey: .rule) + try ruleset?.encode(on: &_container, forKey: .ruleset) + try sourceId?.encode(on: &_container, forKey: .sourceId, auxiliaryKey: ._sourceId) + try validateProfileId?.encode(on: &_container, forKey: .validateProfileId, auxiliaryKey: ._validateProfileId) + try value?.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try warningOnly?.encode(on: &_container, forKey: .warningOnly, auxiliaryKey: ._warningOnly) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptSetupActionAssert else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return compareToSourceExpression == _other.compareToSourceExpression + && compareToSourceId == _other.compareToSourceId + && compareToSourcePath == _other.compareToSourcePath + && contentType == _other.contentType + && description_fhir == _other.description_fhir + && direction == _other.direction + && expression == _other.expression + && headerField == _other.headerField + && label == _other.label + && minimumId == _other.minimumId + && navigationLinks == _other.navigationLinks + && `operator` == _other.`operator` + && path == _other.path + && requestMethod == _other.requestMethod + && requestURL == _other.requestURL + && resource == _other.resource + && response == _other.response + && responseCode == _other.responseCode + && rule == _other.rule + && ruleset == _other.ruleset + && sourceId == _other.sourceId + && validateProfileId == _other.validateProfileId + && value == _other.value + && warningOnly == _other.warningOnly + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(compareToSourceExpression) + hasher.combine(compareToSourceId) + hasher.combine(compareToSourcePath) + hasher.combine(contentType) + hasher.combine(description_fhir) + hasher.combine(direction) + hasher.combine(expression) + hasher.combine(headerField) + hasher.combine(label) + hasher.combine(minimumId) + hasher.combine(navigationLinks) + hasher.combine(`operator`) + hasher.combine(path) + hasher.combine(requestMethod) + hasher.combine(requestURL) + hasher.combine(resource) + hasher.combine(response) + hasher.combine(responseCode) + hasher.combine(rule) + hasher.combine(ruleset) + hasher.combine(sourceId) + hasher.combine(validateProfileId) + hasher.combine(value) + hasher.combine(warningOnly) + } +} + +/** + The reference to a TestScript.rule. + + The TestScript.rule this assert will evaluate. + */ +open class TestScriptSetupActionAssertRule: BackboneElement { + + /// Id of the TestScript.rule + public var ruleId: FHIRPrimitive + + /// Rule parameter template + public var param: [TestScriptSetupActionAssertRuleParam]? + + /// Designated initializer taking all required properties + public init(ruleId: FHIRPrimitive) { + self.ruleId = ruleId + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + param: [TestScriptSetupActionAssertRuleParam]? = nil, + ruleId: FHIRPrimitive) + { + self.init(ruleId: ruleId) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.param = param + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case param + case ruleId; case _ruleId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.param = try [TestScriptSetupActionAssertRuleParam](from: _container, forKeyIfPresent: .param) + self.ruleId = try FHIRPrimitive(from: _container, forKey: .ruleId, auxiliaryKey: ._ruleId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try param?.encode(on: &_container, forKey: .param) + try ruleId.encode(on: &_container, forKey: .ruleId, auxiliaryKey: ._ruleId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptSetupActionAssertRule else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return param == _other.param + && ruleId == _other.ruleId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(param) + hasher.combine(ruleId) + } +} + +/** + Rule parameter template. + + Each rule template can take one or more parameters for rule evaluation. + */ +open class TestScriptSetupActionAssertRuleParam: BackboneElement { + + /// Parameter name matching external assert rule parameter + public var name: FHIRPrimitive + + /// Parameter value defined either explicitly or dynamically + public var value: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive, value: FHIRPrimitive) { + self.name = name + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + value: FHIRPrimitive) + { + self.init(name: name, value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case name; case _name + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptSetupActionAssertRuleParam else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return name == _other.name + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(name) + hasher.combine(value) + } +} + +/** + The reference to a TestScript.ruleset. + + The TestScript.ruleset this assert will evaluate. + */ +open class TestScriptSetupActionAssertRuleset: BackboneElement { + + /// Id of the TestScript.ruleset + public var rulesetId: FHIRPrimitive + + /// The referenced rule within the ruleset + public var rule: [TestScriptSetupActionAssertRulesetRule]? + + /// Designated initializer taking all required properties + public init(rulesetId: FHIRPrimitive) { + self.rulesetId = rulesetId + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + rule: [TestScriptSetupActionAssertRulesetRule]? = nil, + rulesetId: FHIRPrimitive) + { + self.init(rulesetId: rulesetId) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.rule = rule + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case rule + case rulesetId; case _rulesetId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.rule = try [TestScriptSetupActionAssertRulesetRule](from: _container, forKeyIfPresent: .rule) + self.rulesetId = try FHIRPrimitive(from: _container, forKey: .rulesetId, auxiliaryKey: ._rulesetId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try rule?.encode(on: &_container, forKey: .rule) + try rulesetId.encode(on: &_container, forKey: .rulesetId, auxiliaryKey: ._rulesetId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptSetupActionAssertRuleset else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return rule == _other.rule + && rulesetId == _other.rulesetId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(rule) + hasher.combine(rulesetId) + } +} + +/** + The referenced rule within the ruleset. + + The referenced rule within the external ruleset template. + */ +open class TestScriptSetupActionAssertRulesetRule: BackboneElement { + + /// Id of referenced rule within the ruleset + public var ruleId: FHIRPrimitive + + /// Rule parameter template + public var param: [TestScriptSetupActionAssertRulesetRuleParam]? + + /// Designated initializer taking all required properties + public init(ruleId: FHIRPrimitive) { + self.ruleId = ruleId + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + param: [TestScriptSetupActionAssertRulesetRuleParam]? = nil, + ruleId: FHIRPrimitive) + { + self.init(ruleId: ruleId) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.param = param + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case param + case ruleId; case _ruleId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.param = try [TestScriptSetupActionAssertRulesetRuleParam](from: _container, forKeyIfPresent: .param) + self.ruleId = try FHIRPrimitive(from: _container, forKey: .ruleId, auxiliaryKey: ._ruleId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try param?.encode(on: &_container, forKey: .param) + try ruleId.encode(on: &_container, forKey: .ruleId, auxiliaryKey: ._ruleId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptSetupActionAssertRulesetRule else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return param == _other.param + && ruleId == _other.ruleId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(param) + hasher.combine(ruleId) + } +} + +/** + Rule parameter template. + + Each rule template can take one or more parameters for rule evaluation. + */ +open class TestScriptSetupActionAssertRulesetRuleParam: BackboneElement { + + /// Parameter name matching external assert ruleset rule parameter + public var name: FHIRPrimitive + + /// Parameter value defined either explicitly or dynamically + public var value: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive, value: FHIRPrimitive) { + self.name = name + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + value: FHIRPrimitive) + { + self.init(name: name, value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case name; case _name + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptSetupActionAssertRulesetRuleParam else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return name == _other.name + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(name) + hasher.combine(value) + } +} + +/** + The setup operation to perform. + + The operation to perform. + */ +open class TestScriptSetupActionOperation: BackboneElement { + + /// The operation code type that will be executed + public var type: Coding? + + /// Resource type + public var resource: FHIRPrimitive? + + /// Tracking/logging operation label + public var label: FHIRPrimitive? + + /// Tracking/reporting operation description + public var description_fhir: FHIRPrimitive? + + /// The content-type or mime-type to use for RESTful operation in the 'Accept' header. + public var accept: FHIRPrimitive? + + /// The content-type or mime-type to use for RESTful operation in the 'Content-Type' header. + public var contentType: FHIRPrimitive? + + /// Server responding to the request + public var destination: FHIRPrimitive? + + /// Whether or not to send the request url in encoded format + public var encodeRequestUrl: FHIRPrimitive? + + /// Server initiating the request + public var origin: FHIRPrimitive? + + /// Explicitly defined path parameters + public var params: FHIRPrimitive? + + /// Each operation can have one or more header elements + public var requestHeader: [TestScriptSetupActionOperationRequestHeader]? + + /// Fixture Id of mapped request + public var requestId: FHIRPrimitive? + + /// Fixture Id of mapped response + public var responseId: FHIRPrimitive? + + /// Fixture Id of body for PUT and POST requests + public var sourceId: FHIRPrimitive? + + /// Id of fixture used for extracting the [id], [type], and [vid] for GET requests + public var targetId: FHIRPrimitive? + + /// Request URL + public var url: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + accept: FHIRPrimitive? = nil, + contentType: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + destination: FHIRPrimitive? = nil, + encodeRequestUrl: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + label: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + origin: FHIRPrimitive? = nil, + params: FHIRPrimitive? = nil, + requestHeader: [TestScriptSetupActionOperationRequestHeader]? = nil, + requestId: FHIRPrimitive? = nil, + resource: FHIRPrimitive? = nil, + responseId: FHIRPrimitive? = nil, + sourceId: FHIRPrimitive? = nil, + targetId: FHIRPrimitive? = nil, + type: Coding? = nil, + url: FHIRPrimitive? = nil) + { + self.init() + self.accept = accept + self.contentType = contentType + self.description_fhir = description_fhir + self.destination = destination + self.encodeRequestUrl = encodeRequestUrl + self.`extension` = `extension` + self.id = id + self.label = label + self.modifierExtension = modifierExtension + self.origin = origin + self.params = params + self.requestHeader = requestHeader + self.requestId = requestId + self.resource = resource + self.responseId = responseId + self.sourceId = sourceId + self.targetId = targetId + self.type = type + self.url = url + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case accept; case _accept + case contentType; case _contentType + case description_fhir = "description"; case _description_fhir = "_description" + case destination; case _destination + case encodeRequestUrl; case _encodeRequestUrl + case label; case _label + case origin; case _origin + case params; case _params + case requestHeader + case requestId; case _requestId + case resource; case _resource + case responseId; case _responseId + case sourceId; case _sourceId + case targetId; case _targetId + case type + case url; case _url + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.accept = try FHIRPrimitive(from: _container, forKeyIfPresent: .accept, auxiliaryKey: ._accept) + self.contentType = try FHIRPrimitive(from: _container, forKeyIfPresent: .contentType, auxiliaryKey: ._contentType) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.destination = try FHIRPrimitive(from: _container, forKeyIfPresent: .destination, auxiliaryKey: ._destination) + self.encodeRequestUrl = try FHIRPrimitive(from: _container, forKeyIfPresent: .encodeRequestUrl, auxiliaryKey: ._encodeRequestUrl) + self.label = try FHIRPrimitive(from: _container, forKeyIfPresent: .label, auxiliaryKey: ._label) + self.origin = try FHIRPrimitive(from: _container, forKeyIfPresent: .origin, auxiliaryKey: ._origin) + self.params = try FHIRPrimitive(from: _container, forKeyIfPresent: .params, auxiliaryKey: ._params) + self.requestHeader = try [TestScriptSetupActionOperationRequestHeader](from: _container, forKeyIfPresent: .requestHeader) + self.requestId = try FHIRPrimitive(from: _container, forKeyIfPresent: .requestId, auxiliaryKey: ._requestId) + self.resource = try FHIRPrimitive(from: _container, forKeyIfPresent: .resource, auxiliaryKey: ._resource) + self.responseId = try FHIRPrimitive(from: _container, forKeyIfPresent: .responseId, auxiliaryKey: ._responseId) + self.sourceId = try FHIRPrimitive(from: _container, forKeyIfPresent: .sourceId, auxiliaryKey: ._sourceId) + self.targetId = try FHIRPrimitive(from: _container, forKeyIfPresent: .targetId, auxiliaryKey: ._targetId) + self.type = try Coding(from: _container, forKeyIfPresent: .type) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try accept?.encode(on: &_container, forKey: .accept, auxiliaryKey: ._accept) + try contentType?.encode(on: &_container, forKey: .contentType, auxiliaryKey: ._contentType) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try destination?.encode(on: &_container, forKey: .destination, auxiliaryKey: ._destination) + try encodeRequestUrl?.encode(on: &_container, forKey: .encodeRequestUrl, auxiliaryKey: ._encodeRequestUrl) + try label?.encode(on: &_container, forKey: .label, auxiliaryKey: ._label) + try origin?.encode(on: &_container, forKey: .origin, auxiliaryKey: ._origin) + try params?.encode(on: &_container, forKey: .params, auxiliaryKey: ._params) + try requestHeader?.encode(on: &_container, forKey: .requestHeader) + try requestId?.encode(on: &_container, forKey: .requestId, auxiliaryKey: ._requestId) + try resource?.encode(on: &_container, forKey: .resource, auxiliaryKey: ._resource) + try responseId?.encode(on: &_container, forKey: .responseId, auxiliaryKey: ._responseId) + try sourceId?.encode(on: &_container, forKey: .sourceId, auxiliaryKey: ._sourceId) + try targetId?.encode(on: &_container, forKey: .targetId, auxiliaryKey: ._targetId) + try type?.encode(on: &_container, forKey: .type) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptSetupActionOperation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return accept == _other.accept + && contentType == _other.contentType + && description_fhir == _other.description_fhir + && destination == _other.destination + && encodeRequestUrl == _other.encodeRequestUrl + && label == _other.label + && origin == _other.origin + && params == _other.params + && requestHeader == _other.requestHeader + && requestId == _other.requestId + && resource == _other.resource + && responseId == _other.responseId + && sourceId == _other.sourceId + && targetId == _other.targetId + && type == _other.type + && url == _other.url + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(accept) + hasher.combine(contentType) + hasher.combine(description_fhir) + hasher.combine(destination) + hasher.combine(encodeRequestUrl) + hasher.combine(label) + hasher.combine(origin) + hasher.combine(params) + hasher.combine(requestHeader) + hasher.combine(requestId) + hasher.combine(resource) + hasher.combine(responseId) + hasher.combine(sourceId) + hasher.combine(targetId) + hasher.combine(type) + hasher.combine(url) + } +} + +/** + Each operation can have one or more header elements. + + Header elements would be used to set HTTP headers. + */ +open class TestScriptSetupActionOperationRequestHeader: BackboneElement { + + /// HTTP header field name + public var field: FHIRPrimitive + + /// HTTP headerfield value + public var value: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(field: FHIRPrimitive, value: FHIRPrimitive) { + self.field = field + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + field: FHIRPrimitive, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + value: FHIRPrimitive) + { + self.init(field: field, value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case field; case _field + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.field = try FHIRPrimitive(from: _container, forKey: .field, auxiliaryKey: ._field) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try field.encode(on: &_container, forKey: .field, auxiliaryKey: ._field) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptSetupActionOperationRequestHeader else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return field == _other.field + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(field) + hasher.combine(value) + } +} + +/** + A series of required clean up steps. + + A series of operations required to clean up after the all the tests are executed (successfully or otherwise). + */ +open class TestScriptTeardown: BackboneElement { + + /// One or more teardown operations to perform + public var action: [TestScriptTeardownAction] + + /// Designated initializer taking all required properties + public init(action: [TestScriptTeardownAction]) { + self.action = action + super.init() + } + + /// Convenience initializer + public convenience init( + action: [TestScriptTeardownAction], + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(action: action) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [TestScriptTeardownAction](from: _container, forKey: .action) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action.encode(on: &_container, forKey: .action) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptTeardown else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + } +} + +/** + One or more teardown operations to perform. + + The teardown action will only contain an operation. + */ +open class TestScriptTeardownAction: BackboneElement { + + /// The teardown operation to perform + public var operation: TestScriptSetupActionOperation + + /// Designated initializer taking all required properties + public init(operation: TestScriptSetupActionOperation) { + self.operation = operation + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + operation: TestScriptSetupActionOperation) + { + self.init(operation: operation) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case operation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.operation = try TestScriptSetupActionOperation(from: _container, forKey: .operation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try operation.encode(on: &_container, forKey: .operation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptTeardownAction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return operation == _other.operation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(operation) + } +} + +/** + A test in this script. + */ +open class TestScriptTest: BackboneElement { + + /// Tracking/logging name of this test + public var name: FHIRPrimitive? + + /// Tracking/reporting short description of the test + public var description_fhir: FHIRPrimitive? + + /// A test operation or assert to perform + public var action: [TestScriptTestAction] + + /// Designated initializer taking all required properties + public init(action: [TestScriptTestAction]) { + self.action = action + super.init() + } + + /// Convenience initializer + public convenience init( + action: [TestScriptTestAction], + description_fhir: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil) + { + self.init(action: action) + self.description_fhir = description_fhir + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.name = name + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case action + case description_fhir = "description"; case _description_fhir = "_description" + case name; case _name + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.action = try [TestScriptTestAction](from: _container, forKey: .action) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try action.encode(on: &_container, forKey: .action) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptTest else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return action == _other.action + && description_fhir == _other.description_fhir + && name == _other.name + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(action) + hasher.combine(description_fhir) + hasher.combine(name) + } +} + +/** + A test operation or assert to perform. + + Action would contain either an operation or an assertion. + */ +open class TestScriptTestAction: BackboneElement { + + /// The setup operation to perform + public var operation: TestScriptSetupActionOperation? + + /// The setup assertion to perform + public var assert: TestScriptSetupActionAssert? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + assert: TestScriptSetupActionAssert? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + operation: TestScriptSetupActionOperation? = nil) + { + self.init() + self.assert = assert + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.operation = operation + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case assert + case operation + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.assert = try TestScriptSetupActionAssert(from: _container, forKeyIfPresent: .assert) + self.operation = try TestScriptSetupActionOperation(from: _container, forKeyIfPresent: .operation) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try assert?.encode(on: &_container, forKey: .assert) + try operation?.encode(on: &_container, forKey: .operation) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptTestAction else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return assert == _other.assert + && operation == _other.operation + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(assert) + hasher.combine(operation) + } +} + +/** + Placeholder for evaluated elements. + + Variable is set based either on element value in response body or on header field value in the response headers. + */ +open class TestScriptVariable: BackboneElement { + + /// Descriptive name for this variable + public var name: FHIRPrimitive + + /// Default, hard-coded, or user-defined value for this variable + public var defaultValue: FHIRPrimitive? + + /// Natural language description of the variable + public var description_fhir: FHIRPrimitive? + + /// The fluentpath expression against the fixture body + public var expression: FHIRPrimitive? + + /// HTTP header field name for source + public var headerField: FHIRPrimitive? + + /// Hint help text for default value to enter + public var hint: FHIRPrimitive? + + /// XPath or JSONPath against the fixture body + public var path: FHIRPrimitive? + + /// Fixture Id of source expression or headerField within this variable + public var sourceId: FHIRPrimitive? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive) { + self.name = name + super.init() + } + + /// Convenience initializer + public convenience init( + defaultValue: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + expression: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + headerField: FHIRPrimitive? = nil, + hint: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + path: FHIRPrimitive? = nil, + sourceId: FHIRPrimitive? = nil) + { + self.init(name: name) + self.defaultValue = defaultValue + self.description_fhir = description_fhir + self.expression = expression + self.`extension` = `extension` + self.headerField = headerField + self.hint = hint + self.id = id + self.modifierExtension = modifierExtension + self.path = path + self.sourceId = sourceId + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case defaultValue; case _defaultValue + case description_fhir = "description"; case _description_fhir = "_description" + case expression; case _expression + case headerField; case _headerField + case hint; case _hint + case name; case _name + case path; case _path + case sourceId; case _sourceId + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.defaultValue = try FHIRPrimitive(from: _container, forKeyIfPresent: .defaultValue, auxiliaryKey: ._defaultValue) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.expression = try FHIRPrimitive(from: _container, forKeyIfPresent: .expression, auxiliaryKey: ._expression) + self.headerField = try FHIRPrimitive(from: _container, forKeyIfPresent: .headerField, auxiliaryKey: ._headerField) + self.hint = try FHIRPrimitive(from: _container, forKeyIfPresent: .hint, auxiliaryKey: ._hint) + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + self.path = try FHIRPrimitive(from: _container, forKeyIfPresent: .path, auxiliaryKey: ._path) + self.sourceId = try FHIRPrimitive(from: _container, forKeyIfPresent: .sourceId, auxiliaryKey: ._sourceId) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try defaultValue?.encode(on: &_container, forKey: .defaultValue, auxiliaryKey: ._defaultValue) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try expression?.encode(on: &_container, forKey: .expression, auxiliaryKey: ._expression) + try headerField?.encode(on: &_container, forKey: .headerField, auxiliaryKey: ._headerField) + try hint?.encode(on: &_container, forKey: .hint, auxiliaryKey: ._hint) + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try path?.encode(on: &_container, forKey: .path, auxiliaryKey: ._path) + try sourceId?.encode(on: &_container, forKey: .sourceId, auxiliaryKey: ._sourceId) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TestScriptVariable else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return defaultValue == _other.defaultValue + && description_fhir == _other.description_fhir + && expression == _other.expression + && headerField == _other.headerField + && hint == _other.hint + && name == _other.name + && path == _other.path + && sourceId == _other.sourceId + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(defaultValue) + hasher.combine(description_fhir) + hasher.combine(expression) + hasher.combine(headerField) + hasher.combine(hint) + hasher.combine(name) + hasher.combine(path) + hasher.combine(sourceId) + } +} diff --git a/Sources/ModelsSTU3/Timing.swift b/Sources/ModelsSTU3/Timing.swift new file mode 100644 index 0000000..44cb86a --- /dev/null +++ b/Sources/ModelsSTU3/Timing.swift @@ -0,0 +1,359 @@ +// +// Timing.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/Timing) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A timing schedule that specifies an event that may occur multiple times. + + Specifies an event that may occur multiple times. Timing schedules are used to record when things are planned, expected + or requested to occur. The most common usage is in dosage instructions for medications. They are also used when + planning care of various kinds, and may be used for reporting the schedule to which past regular activities were + carried out. + */ +open class Timing: Element { + + /// When the event occurs + public var event: [FHIRPrimitive]? + + /// When the event is to occur + public var `repeat`: TimingRepeat? + + /// BID | TID | QID | AM | PM | QD | QOD | Q4H | Q6H + + public var code: CodeableConcept? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + code: CodeableConcept? = nil, + event: [FHIRPrimitive]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + `repeat`: TimingRepeat? = nil) + { + self.init() + self.code = code + self.event = event + self.`extension` = `extension` + self.id = id + self.`repeat` = `repeat` + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case event; case _event + case `repeat` = "repeat" + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try CodeableConcept(from: _container, forKeyIfPresent: .code) + self.event = try [FHIRPrimitive](from: _container, forKeyIfPresent: .event, auxiliaryKey: ._event) + self.`repeat` = try TimingRepeat(from: _container, forKeyIfPresent: .`repeat`) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code?.encode(on: &_container, forKey: .code) + try event?.encode(on: &_container, forKey: .event, auxiliaryKey: ._event) + try `repeat`?.encode(on: &_container, forKey: .`repeat`) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? Timing else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && event == _other.event + && `repeat` == _other.`repeat` + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(event) + hasher.combine(`repeat`) + } +} + +/** + When the event is to occur. + + A set of rules that describe when the event is scheduled. + */ +open class TimingRepeat: Element { + + /// All possible types for "bounds[x]" + public enum BoundsX: Hashable { + case duration(Duration) + case period(Period) + case range(Range) + } + + /// Length/Range of lengths, or (Start and/or end) limits + /// One of `bounds[x]` + public var bounds: BoundsX? + + /// Number of times to repeat + public var count: FHIRPrimitive? + + /// Maximum number of times to repeat + public var countMax: FHIRPrimitive? + + /// How long when it happens + public var duration: FHIRPrimitive? + + /// How long when it happens (Max) + public var durationMax: FHIRPrimitive? + + /// s | min | h | d | wk | mo | a - unit of time (UCUM) + public var durationUnit: FHIRPrimitive? + + /// Event occurs frequency times per period + public var frequency: FHIRPrimitive? + + /// Event occurs up to frequencyMax times per period + public var frequencyMax: FHIRPrimitive? + + /// Event occurs frequency times per period + public var period: FHIRPrimitive? + + /// Upper limit of period (3-4 hours) + public var periodMax: FHIRPrimitive? + + /// s | min | h | d | wk | mo | a - unit of time (UCUM) + public var periodUnit: FHIRPrimitive? + + /// If one or more days of week is provided, then the action happens only on the specified day(s). + public var dayOfWeek: [FHIRPrimitive]? + + /// Time of day for action + public var timeOfDay: [FHIRPrimitive]? + + /// Regular life events the event is tied to + public var when: [FHIRPrimitive]? + + /// Minutes from event (before or after) + public var offset: FHIRPrimitive? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + bounds: BoundsX? = nil, + count: FHIRPrimitive? = nil, + countMax: FHIRPrimitive? = nil, + dayOfWeek: [FHIRPrimitive]? = nil, + duration: FHIRPrimitive? = nil, + durationMax: FHIRPrimitive? = nil, + durationUnit: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + frequency: FHIRPrimitive? = nil, + frequencyMax: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + offset: FHIRPrimitive? = nil, + period: FHIRPrimitive? = nil, + periodMax: FHIRPrimitive? = nil, + periodUnit: FHIRPrimitive? = nil, + timeOfDay: [FHIRPrimitive]? = nil, + when: [FHIRPrimitive]? = nil) + { + self.init() + self.bounds = bounds + self.count = count + self.countMax = countMax + self.dayOfWeek = dayOfWeek + self.duration = duration + self.durationMax = durationMax + self.durationUnit = durationUnit + self.`extension` = `extension` + self.frequency = frequency + self.frequencyMax = frequencyMax + self.id = id + self.offset = offset + self.period = period + self.periodMax = periodMax + self.periodUnit = periodUnit + self.timeOfDay = timeOfDay + self.when = when + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case boundsDuration + case boundsPeriod + case boundsRange + case count; case _count + case countMax; case _countMax + case dayOfWeek; case _dayOfWeek + case duration; case _duration + case durationMax; case _durationMax + case durationUnit; case _durationUnit + case frequency; case _frequency + case frequencyMax; case _frequencyMax + case offset; case _offset + case period; case _period + case periodMax; case _periodMax + case periodUnit; case _periodUnit + case timeOfDay; case _timeOfDay + case when; case _when + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + var _t_bounds: BoundsX? = nil + if let boundsDuration = try Duration(from: _container, forKeyIfPresent: .boundsDuration) { + if _t_bounds != nil { + throw DecodingError.dataCorruptedError(forKey: .boundsDuration, in: _container, debugDescription: "More than one value provided for \"bounds\"") + } + _t_bounds = .duration(boundsDuration) + } + if let boundsRange = try Range(from: _container, forKeyIfPresent: .boundsRange) { + if _t_bounds != nil { + throw DecodingError.dataCorruptedError(forKey: .boundsRange, in: _container, debugDescription: "More than one value provided for \"bounds\"") + } + _t_bounds = .range(boundsRange) + } + if let boundsPeriod = try Period(from: _container, forKeyIfPresent: .boundsPeriod) { + if _t_bounds != nil { + throw DecodingError.dataCorruptedError(forKey: .boundsPeriod, in: _container, debugDescription: "More than one value provided for \"bounds\"") + } + _t_bounds = .period(boundsPeriod) + } + self.bounds = _t_bounds + self.count = try FHIRPrimitive(from: _container, forKeyIfPresent: .count, auxiliaryKey: ._count) + self.countMax = try FHIRPrimitive(from: _container, forKeyIfPresent: .countMax, auxiliaryKey: ._countMax) + self.dayOfWeek = try [FHIRPrimitive](from: _container, forKeyIfPresent: .dayOfWeek, auxiliaryKey: ._dayOfWeek) + self.duration = try FHIRPrimitive(from: _container, forKeyIfPresent: .duration, auxiliaryKey: ._duration) + self.durationMax = try FHIRPrimitive(from: _container, forKeyIfPresent: .durationMax, auxiliaryKey: ._durationMax) + self.durationUnit = try FHIRPrimitive(from: _container, forKeyIfPresent: .durationUnit, auxiliaryKey: ._durationUnit) + self.frequency = try FHIRPrimitive(from: _container, forKeyIfPresent: .frequency, auxiliaryKey: ._frequency) + self.frequencyMax = try FHIRPrimitive(from: _container, forKeyIfPresent: .frequencyMax, auxiliaryKey: ._frequencyMax) + self.offset = try FHIRPrimitive(from: _container, forKeyIfPresent: .offset, auxiliaryKey: ._offset) + self.period = try FHIRPrimitive(from: _container, forKeyIfPresent: .period, auxiliaryKey: ._period) + self.periodMax = try FHIRPrimitive(from: _container, forKeyIfPresent: .periodMax, auxiliaryKey: ._periodMax) + self.periodUnit = try FHIRPrimitive(from: _container, forKeyIfPresent: .periodUnit, auxiliaryKey: ._periodUnit) + self.timeOfDay = try [FHIRPrimitive](from: _container, forKeyIfPresent: .timeOfDay, auxiliaryKey: ._timeOfDay) + self.when = try [FHIRPrimitive](from: _container, forKeyIfPresent: .when, auxiliaryKey: ._when) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + if let _enum = bounds { + switch _enum { + case .duration(let _value): + try _value.encode(on: &_container, forKey: .boundsDuration) + case .range(let _value): + try _value.encode(on: &_container, forKey: .boundsRange) + case .period(let _value): + try _value.encode(on: &_container, forKey: .boundsPeriod) + } + } + try count?.encode(on: &_container, forKey: .count, auxiliaryKey: ._count) + try countMax?.encode(on: &_container, forKey: .countMax, auxiliaryKey: ._countMax) + try dayOfWeek?.encode(on: &_container, forKey: .dayOfWeek, auxiliaryKey: ._dayOfWeek) + try duration?.encode(on: &_container, forKey: .duration, auxiliaryKey: ._duration) + try durationMax?.encode(on: &_container, forKey: .durationMax, auxiliaryKey: ._durationMax) + try durationUnit?.encode(on: &_container, forKey: .durationUnit, auxiliaryKey: ._durationUnit) + try frequency?.encode(on: &_container, forKey: .frequency, auxiliaryKey: ._frequency) + try frequencyMax?.encode(on: &_container, forKey: .frequencyMax, auxiliaryKey: ._frequencyMax) + try offset?.encode(on: &_container, forKey: .offset, auxiliaryKey: ._offset) + try period?.encode(on: &_container, forKey: .period, auxiliaryKey: ._period) + try periodMax?.encode(on: &_container, forKey: .periodMax, auxiliaryKey: ._periodMax) + try periodUnit?.encode(on: &_container, forKey: .periodUnit, auxiliaryKey: ._periodUnit) + try timeOfDay?.encode(on: &_container, forKey: .timeOfDay, auxiliaryKey: ._timeOfDay) + try when?.encode(on: &_container, forKey: .when, auxiliaryKey: ._when) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TimingRepeat else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return bounds == _other.bounds + && count == _other.count + && countMax == _other.countMax + && dayOfWeek == _other.dayOfWeek + && duration == _other.duration + && durationMax == _other.durationMax + && durationUnit == _other.durationUnit + && frequency == _other.frequency + && frequencyMax == _other.frequencyMax + && offset == _other.offset + && period == _other.period + && periodMax == _other.periodMax + && periodUnit == _other.periodUnit + && timeOfDay == _other.timeOfDay + && when == _other.when + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(bounds) + hasher.combine(count) + hasher.combine(countMax) + hasher.combine(dayOfWeek) + hasher.combine(duration) + hasher.combine(durationMax) + hasher.combine(durationUnit) + hasher.combine(frequency) + hasher.combine(frequencyMax) + hasher.combine(offset) + hasher.combine(period) + hasher.combine(periodMax) + hasher.combine(periodUnit) + hasher.combine(timeOfDay) + hasher.combine(when) + } +} diff --git a/Sources/ModelsSTU3/TriggerDefinition.swift b/Sources/ModelsSTU3/TriggerDefinition.swift new file mode 100644 index 0000000..c5f72b9 --- /dev/null +++ b/Sources/ModelsSTU3/TriggerDefinition.swift @@ -0,0 +1,167 @@ +// +// TriggerDefinition.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/TriggerDefinition) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Defines an expected trigger for a module. + + A description of a triggering event. + */ +open class TriggerDefinition: Element { + + /// All possible types for "eventTiming[x]" + public enum EventTimingX: Hashable { + case date(FHIRPrimitive) + case dateTime(FHIRPrimitive) + case reference(Reference) + case timing(Timing) + } + + /// The type of triggering event. + public var type: FHIRPrimitive + + /// Triggering event name + public var eventName: FHIRPrimitive? + + /// Timing of the event + /// One of `eventTiming[x]` + public var eventTiming: EventTimingX? + + /// Triggering data of the event + public var eventData: DataRequirement? + + /// Designated initializer taking all required properties + public init(type: FHIRPrimitive) { + self.type = type + super.init() + } + + /// Convenience initializer + public convenience init( + eventData: DataRequirement? = nil, + eventName: FHIRPrimitive? = nil, + eventTiming: EventTimingX? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + type: FHIRPrimitive) + { + self.init(type: type) + self.eventData = eventData + self.eventName = eventName + self.eventTiming = eventTiming + self.`extension` = `extension` + self.id = id + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case eventData + case eventName; case _eventName + case eventTimingDate; case _eventTimingDate + case eventTimingDateTime; case _eventTimingDateTime + case eventTimingReference + case eventTimingTiming + case type; case _type + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.eventData = try DataRequirement(from: _container, forKeyIfPresent: .eventData) + self.eventName = try FHIRPrimitive(from: _container, forKeyIfPresent: .eventName, auxiliaryKey: ._eventName) + var _t_eventTiming: EventTimingX? = nil + if let eventTimingTiming = try Timing(from: _container, forKeyIfPresent: .eventTimingTiming) { + if _t_eventTiming != nil { + throw DecodingError.dataCorruptedError(forKey: .eventTimingTiming, in: _container, debugDescription: "More than one value provided for \"eventTiming\"") + } + _t_eventTiming = .timing(eventTimingTiming) + } + if let eventTimingReference = try Reference(from: _container, forKeyIfPresent: .eventTimingReference) { + if _t_eventTiming != nil { + throw DecodingError.dataCorruptedError(forKey: .eventTimingReference, in: _container, debugDescription: "More than one value provided for \"eventTiming\"") + } + _t_eventTiming = .reference(eventTimingReference) + } + if let eventTimingDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .eventTimingDate, auxiliaryKey: ._eventTimingDate) { + if _t_eventTiming != nil { + throw DecodingError.dataCorruptedError(forKey: .eventTimingDate, in: _container, debugDescription: "More than one value provided for \"eventTiming\"") + } + _t_eventTiming = .date(eventTimingDate) + } + if let eventTimingDateTime = try FHIRPrimitive(from: _container, forKeyIfPresent: .eventTimingDateTime, auxiliaryKey: ._eventTimingDateTime) { + if _t_eventTiming != nil { + throw DecodingError.dataCorruptedError(forKey: .eventTimingDateTime, in: _container, debugDescription: "More than one value provided for \"eventTiming\"") + } + _t_eventTiming = .dateTime(eventTimingDateTime) + } + self.eventTiming = _t_eventTiming + self.type = try FHIRPrimitive(from: _container, forKey: .type, auxiliaryKey: ._type) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try eventData?.encode(on: &_container, forKey: .eventData) + try eventName?.encode(on: &_container, forKey: .eventName, auxiliaryKey: ._eventName) + if let _enum = eventTiming { + switch _enum { + case .timing(let _value): + try _value.encode(on: &_container, forKey: .eventTimingTiming) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .eventTimingReference) + case .date(let _value): + try _value.encode(on: &_container, forKey: .eventTimingDate, auxiliaryKey: ._eventTimingDate) + case .dateTime(let _value): + try _value.encode(on: &_container, forKey: .eventTimingDateTime, auxiliaryKey: ._eventTimingDateTime) + } + } + try type.encode(on: &_container, forKey: .type, auxiliaryKey: ._type) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? TriggerDefinition else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return eventData == _other.eventData + && eventName == _other.eventName + && eventTiming == _other.eventTiming + && type == _other.type + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(eventData) + hasher.combine(eventName) + hasher.combine(eventTiming) + hasher.combine(type) + } +} diff --git a/Sources/ModelsSTU3/UsageContext.swift b/Sources/ModelsSTU3/UsageContext.swift new file mode 100644 index 0000000..22e3605 --- /dev/null +++ b/Sources/ModelsSTU3/UsageContext.swift @@ -0,0 +1,144 @@ +// +// UsageContext.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/UsageContext) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Describes the context of use for a conformance or knowledge resource. + + Specifies clinical/business/etc metadata that can be used to retrieve, index and/or categorize an artifact. This + metadata can either be specific to the applicable population (e.g., age category, DRG) or the specific context of care + (e.g., venue, care setting, provider of care). + */ +open class UsageContext: Element { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case codeableConcept(CodeableConcept) + case quantity(Quantity) + case range(Range) + } + + /// Type of context being specified + public var code: Coding + + /// Value that defines the context + /// One of `value[x]` + public var value: ValueX + + /// Designated initializer taking all required properties + public init(code: Coding, value: ValueX) { + self.code = code + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + code: Coding, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + value: ValueX) + { + self.init(code: code, value: value) + self.`extension` = `extension` + self.id = id + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code + case valueCodeableConcept + case valueQuantity + case valueRange + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Validate that we have at least one of the mandatory properties for expanded properties + guard _container.contains(CodingKeys.valueCodeableConcept) || _container.contains(CodingKeys.valueQuantity) || _container.contains(CodingKeys.valueRange) else { + throw DecodingError.valueNotFound(Any.self, DecodingError.Context(codingPath: [CodingKeys.valueCodeableConcept, CodingKeys.valueQuantity, CodingKeys.valueRange], debugDescription: "Must have at least one value for \"value\" but have none")) + } + + // Decode all our properties + self.code = try Coding(from: _container, forKey: .code) + var _t_value: ValueX? = nil + if let valueCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .valueCodeableConcept) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCodeableConcept, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .codeableConcept(valueCodeableConcept) + } + if let valueQuantity = try Quantity(from: _container, forKeyIfPresent: .valueQuantity) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueQuantity, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .quantity(valueQuantity) + } + if let valueRange = try Range(from: _container, forKeyIfPresent: .valueRange) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueRange, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .range(valueRange) + } + self.value = _t_value! + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code) + + switch value { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .valueCodeableConcept) + case .quantity(let _value): + try _value.encode(on: &_container, forKey: .valueQuantity) + case .range(let _value): + try _value.encode(on: &_container, forKey: .valueRange) + } + + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? UsageContext else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/ValueSet.swift b/Sources/ModelsSTU3/ValueSet.swift new file mode 100644 index 0000000..4f123ce --- /dev/null +++ b/Sources/ModelsSTU3/ValueSet.swift @@ -0,0 +1,1182 @@ +// +// ValueSet.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ValueSet) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + A set of codes drawn from one or more code systems. + + A value set specifies a set of codes drawn from one or more code systems. + */ +open class ValueSet: DomainResource { + + override open class var resourceType: ResourceType { return .valueSet } + + /// Logical URI to reference this value set (globally unique) + public var url: FHIRPrimitive? + + /// Additional identifier for the value set + public var identifier: [Identifier]? + + /// Business version of the value set + public var version: FHIRPrimitive? + + /// Name for this value set (computer friendly) + public var name: FHIRPrimitive? + + /// Name for this value set (human friendly) + public var title: FHIRPrimitive? + + /// The status of this value set. Enables tracking the life-cycle of the content. + public var status: FHIRPrimitive + + /// For testing purposes, not real usage + public var experimental: FHIRPrimitive? + + /// Date this was last changed + public var date: FHIRPrimitive? + + /// Name of the publisher (organization or individual) + public var publisher: FHIRPrimitive? + + /// Contact details for the publisher + public var contact: [ContactDetail]? + + /// Natural language description of the value set + public var description_fhir: FHIRPrimitive? + + /// Context the content is intended to support + public var useContext: [UsageContext]? + + /// Intended jurisdiction for value set (if applicable) + public var jurisdiction: [CodeableConcept]? + + /// Indicates whether or not any change to the content logical definition may occur + public var immutable: FHIRPrimitive? + + /// Why this value set is defined + public var purpose: FHIRPrimitive? + + /// Use and/or publishing restrictions + public var copyright: FHIRPrimitive? + + /// Whether this is intended to be used with an extensible binding + public var extensible: FHIRPrimitive? + + /// Definition of the content of the value set (CLD) + public var compose: ValueSetCompose? + + /// Used when the value set is "expanded" + public var expansion: ValueSetExpansion? + + /// Designated initializer taking all required properties + public init(status: FHIRPrimitive) { + self.status = status + super.init() + } + + /// Convenience initializer + public convenience init( + compose: ValueSetCompose? = nil, + contact: [ContactDetail]? = nil, + contained: [ResourceProxy]? = nil, + copyright: FHIRPrimitive? = nil, + date: FHIRPrimitive? = nil, + description_fhir: FHIRPrimitive? = nil, + expansion: ValueSetExpansion? = nil, + experimental: FHIRPrimitive? = nil, + extensible: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + immutable: FHIRPrimitive? = nil, + implicitRules: FHIRPrimitive? = nil, + jurisdiction: [CodeableConcept]? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive? = nil, + publisher: FHIRPrimitive? = nil, + purpose: FHIRPrimitive? = nil, + status: FHIRPrimitive, + text: Narrative? = nil, + title: FHIRPrimitive? = nil, + url: FHIRPrimitive? = nil, + useContext: [UsageContext]? = nil, + version: FHIRPrimitive? = nil) + { + self.init(status: status) + self.compose = compose + self.contact = contact + self.contained = contained + self.copyright = copyright + self.date = date + self.description_fhir = description_fhir + self.expansion = expansion + self.experimental = experimental + self.extensible = extensible + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.immutable = immutable + self.implicitRules = implicitRules + self.jurisdiction = jurisdiction + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.name = name + self.publisher = publisher + self.purpose = purpose + self.text = text + self.title = title + self.url = url + self.useContext = useContext + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case compose + case contact + case copyright; case _copyright + case date; case _date + case description_fhir = "description"; case _description_fhir = "_description" + case expansion + case experimental; case _experimental + case extensible; case _extensible + case identifier + case immutable; case _immutable + case jurisdiction + case name; case _name + case publisher; case _publisher + case purpose; case _purpose + case status; case _status + case title; case _title + case url; case _url + case useContext + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.compose = try ValueSetCompose(from: _container, forKeyIfPresent: .compose) + self.contact = try [ContactDetail](from: _container, forKeyIfPresent: .contact) + self.copyright = try FHIRPrimitive(from: _container, forKeyIfPresent: .copyright, auxiliaryKey: ._copyright) + self.date = try FHIRPrimitive(from: _container, forKeyIfPresent: .date, auxiliaryKey: ._date) + self.description_fhir = try FHIRPrimitive(from: _container, forKeyIfPresent: .description_fhir, auxiliaryKey: ._description_fhir) + self.expansion = try ValueSetExpansion(from: _container, forKeyIfPresent: .expansion) + self.experimental = try FHIRPrimitive(from: _container, forKeyIfPresent: .experimental, auxiliaryKey: ._experimental) + self.extensible = try FHIRPrimitive(from: _container, forKeyIfPresent: .extensible, auxiliaryKey: ._extensible) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.immutable = try FHIRPrimitive(from: _container, forKeyIfPresent: .immutable, auxiliaryKey: ._immutable) + self.jurisdiction = try [CodeableConcept](from: _container, forKeyIfPresent: .jurisdiction) + self.name = try FHIRPrimitive(from: _container, forKeyIfPresent: .name, auxiliaryKey: ._name) + self.publisher = try FHIRPrimitive(from: _container, forKeyIfPresent: .publisher, auxiliaryKey: ._publisher) + self.purpose = try FHIRPrimitive(from: _container, forKeyIfPresent: .purpose, auxiliaryKey: ._purpose) + self.status = try FHIRPrimitive(from: _container, forKey: .status, auxiliaryKey: ._status) + self.title = try FHIRPrimitive(from: _container, forKeyIfPresent: .title, auxiliaryKey: ._title) + self.url = try FHIRPrimitive(from: _container, forKeyIfPresent: .url, auxiliaryKey: ._url) + self.useContext = try [UsageContext](from: _container, forKeyIfPresent: .useContext) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try compose?.encode(on: &_container, forKey: .compose) + try contact?.encode(on: &_container, forKey: .contact) + try copyright?.encode(on: &_container, forKey: .copyright, auxiliaryKey: ._copyright) + try date?.encode(on: &_container, forKey: .date, auxiliaryKey: ._date) + try description_fhir?.encode(on: &_container, forKey: .description_fhir, auxiliaryKey: ._description_fhir) + try expansion?.encode(on: &_container, forKey: .expansion) + try experimental?.encode(on: &_container, forKey: .experimental, auxiliaryKey: ._experimental) + try extensible?.encode(on: &_container, forKey: .extensible, auxiliaryKey: ._extensible) + try identifier?.encode(on: &_container, forKey: .identifier) + try immutable?.encode(on: &_container, forKey: .immutable, auxiliaryKey: ._immutable) + try jurisdiction?.encode(on: &_container, forKey: .jurisdiction) + try name?.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + try publisher?.encode(on: &_container, forKey: .publisher, auxiliaryKey: ._publisher) + try purpose?.encode(on: &_container, forKey: .purpose, auxiliaryKey: ._purpose) + try status.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try title?.encode(on: &_container, forKey: .title, auxiliaryKey: ._title) + try url?.encode(on: &_container, forKey: .url, auxiliaryKey: ._url) + try useContext?.encode(on: &_container, forKey: .useContext) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ValueSet else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return compose == _other.compose + && contact == _other.contact + && copyright == _other.copyright + && date == _other.date + && description_fhir == _other.description_fhir + && expansion == _other.expansion + && experimental == _other.experimental + && extensible == _other.extensible + && identifier == _other.identifier + && immutable == _other.immutable + && jurisdiction == _other.jurisdiction + && name == _other.name + && publisher == _other.publisher + && purpose == _other.purpose + && status == _other.status + && title == _other.title + && url == _other.url + && useContext == _other.useContext + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(compose) + hasher.combine(contact) + hasher.combine(copyright) + hasher.combine(date) + hasher.combine(description_fhir) + hasher.combine(expansion) + hasher.combine(experimental) + hasher.combine(extensible) + hasher.combine(identifier) + hasher.combine(immutable) + hasher.combine(jurisdiction) + hasher.combine(name) + hasher.combine(publisher) + hasher.combine(purpose) + hasher.combine(status) + hasher.combine(title) + hasher.combine(url) + hasher.combine(useContext) + hasher.combine(version) + } +} + +/** + Definition of the content of the value set (CLD). + + A set of criteria that define the content logical definition of the value set by including or excluding codes from + outside this value set. This I also known as the "Content Logical Definition" (CLD). + */ +open class ValueSetCompose: BackboneElement { + + /// Fixed date for version-less references (transitive) + public var lockedDate: FHIRPrimitive? + + /// Whether inactive codes are in the value set + public var inactive: FHIRPrimitive? + + /// Include one or more codes from a code system or other value set(s) + public var include: [ValueSetComposeInclude] + + /// Explicitly exclude codes from a code system or other value sets + public var exclude: [ValueSetComposeInclude]? + + /// Designated initializer taking all required properties + public init(include: [ValueSetComposeInclude]) { + self.include = include + super.init() + } + + /// Convenience initializer + public convenience init( + exclude: [ValueSetComposeInclude]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + inactive: FHIRPrimitive? = nil, + include: [ValueSetComposeInclude], + lockedDate: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(include: include) + self.exclude = exclude + self.`extension` = `extension` + self.id = id + self.inactive = inactive + self.lockedDate = lockedDate + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case exclude + case inactive; case _inactive + case include + case lockedDate; case _lockedDate + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.exclude = try [ValueSetComposeInclude](from: _container, forKeyIfPresent: .exclude) + self.inactive = try FHIRPrimitive(from: _container, forKeyIfPresent: .inactive, auxiliaryKey: ._inactive) + self.include = try [ValueSetComposeInclude](from: _container, forKey: .include) + self.lockedDate = try FHIRPrimitive(from: _container, forKeyIfPresent: .lockedDate, auxiliaryKey: ._lockedDate) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try exclude?.encode(on: &_container, forKey: .exclude) + try inactive?.encode(on: &_container, forKey: .inactive, auxiliaryKey: ._inactive) + try include.encode(on: &_container, forKey: .include) + try lockedDate?.encode(on: &_container, forKey: .lockedDate, auxiliaryKey: ._lockedDate) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ValueSetCompose else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return exclude == _other.exclude + && inactive == _other.inactive + && include == _other.include + && lockedDate == _other.lockedDate + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(exclude) + hasher.combine(inactive) + hasher.combine(include) + hasher.combine(lockedDate) + } +} + +/** + Include one or more codes from a code system or other value set(s). + */ +open class ValueSetComposeInclude: BackboneElement { + + /// The system the codes come from + public var system: FHIRPrimitive? + + /// Specific version of the code system referred to + public var version: FHIRPrimitive? + + /// A concept defined in the system + public var concept: [ValueSetComposeIncludeConcept]? + + /// Select codes/concepts by their properties (including relationships) + public var filter: [ValueSetComposeIncludeFilter]? + + /// Select only contents included in this value set + public var valueSet: [FHIRPrimitive]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + concept: [ValueSetComposeIncludeConcept]? = nil, + `extension`: [Extension]? = nil, + filter: [ValueSetComposeIncludeFilter]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + system: FHIRPrimitive? = nil, + valueSet: [FHIRPrimitive]? = nil, + version: FHIRPrimitive? = nil) + { + self.init() + self.concept = concept + self.`extension` = `extension` + self.filter = filter + self.id = id + self.modifierExtension = modifierExtension + self.system = system + self.valueSet = valueSet + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case concept + case filter + case system; case _system + case valueSet; case _valueSet + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.concept = try [ValueSetComposeIncludeConcept](from: _container, forKeyIfPresent: .concept) + self.filter = try [ValueSetComposeIncludeFilter](from: _container, forKeyIfPresent: .filter) + self.system = try FHIRPrimitive(from: _container, forKeyIfPresent: .system, auxiliaryKey: ._system) + self.valueSet = try [FHIRPrimitive](from: _container, forKeyIfPresent: .valueSet, auxiliaryKey: ._valueSet) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try concept?.encode(on: &_container, forKey: .concept) + try filter?.encode(on: &_container, forKey: .filter) + try system?.encode(on: &_container, forKey: .system, auxiliaryKey: ._system) + try valueSet?.encode(on: &_container, forKey: .valueSet, auxiliaryKey: ._valueSet) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ValueSetComposeInclude else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return concept == _other.concept + && filter == _other.filter + && system == _other.system + && valueSet == _other.valueSet + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(concept) + hasher.combine(filter) + hasher.combine(system) + hasher.combine(valueSet) + hasher.combine(version) + } +} + +/** + A concept defined in the system. + + Specifies a concept to be included or excluded. + */ +open class ValueSetComposeIncludeConcept: BackboneElement { + + /// Code or expression from system + public var code: FHIRPrimitive + + /// Text to display for this code for this value set in this valueset + public var display: FHIRPrimitive? + + /// Additional representations for this concept + public var designation: [ValueSetComposeIncludeConceptDesignation]? + + /// Designated initializer taking all required properties + public init(code: FHIRPrimitive) { + self.code = code + super.init() + } + + /// Convenience initializer + public convenience init( + code: FHIRPrimitive, + designation: [ValueSetComposeIncludeConceptDesignation]? = nil, + display: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil) + { + self.init(code: code) + self.designation = designation + self.display = display + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case code; case _code + case designation + case display; case _display + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.code = try FHIRPrimitive(from: _container, forKey: .code, auxiliaryKey: ._code) + self.designation = try [ValueSetComposeIncludeConceptDesignation](from: _container, forKeyIfPresent: .designation) + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try code.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try designation?.encode(on: &_container, forKey: .designation) + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ValueSetComposeIncludeConcept else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return code == _other.code + && designation == _other.designation + && display == _other.display + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(code) + hasher.combine(designation) + hasher.combine(display) + } +} + +/** + Additional representations for this concept. + + Additional representations for this concept when used in this value set - other languages, aliases, specialized + purposes, used for particular purposes, etc. + */ +open class ValueSetComposeIncludeConceptDesignation: BackboneElement { + + /// Human language of the designation + public var language: FHIRPrimitive? + + /// Details how this designation would be used + public var use: Coding? + + /// The text value for this designation + public var value: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(value: FHIRPrimitive) { + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + use: Coding? = nil, + value: FHIRPrimitive) + { + self.init(value: value) + self.`extension` = `extension` + self.id = id + self.language = language + self.modifierExtension = modifierExtension + self.use = use + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case language; case _language + case use + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.language = try FHIRPrimitive(from: _container, forKeyIfPresent: .language, auxiliaryKey: ._language) + self.use = try Coding(from: _container, forKeyIfPresent: .use) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try language?.encode(on: &_container, forKey: .language, auxiliaryKey: ._language) + try use?.encode(on: &_container, forKey: .use) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ValueSetComposeIncludeConceptDesignation else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return language == _other.language + && use == _other.use + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(language) + hasher.combine(use) + hasher.combine(value) + } +} + +/** + Select codes/concepts by their properties (including relationships). + + Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. + If multiple filters are specified, they SHALL all be true. + */ +open class ValueSetComposeIncludeFilter: BackboneElement { + + /// A property defined by the code system + public var property: FHIRPrimitive + + /// The kind of operation to perform as a part of the filter criteria. + public var op: FHIRPrimitive + + /// Code from the system, or regex criteria, or boolean value for exists + public var value: FHIRPrimitive + + /// Designated initializer taking all required properties + public init(op: FHIRPrimitive, property: FHIRPrimitive, value: FHIRPrimitive) { + self.op = op + self.property = property + self.value = value + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + op: FHIRPrimitive, + property: FHIRPrimitive, + value: FHIRPrimitive) + { + self.init(op: op, property: property, value: value) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case op; case _op + case property; case _property + case value; case _value + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.op = try FHIRPrimitive(from: _container, forKey: .op, auxiliaryKey: ._op) + self.property = try FHIRPrimitive(from: _container, forKey: .property, auxiliaryKey: ._property) + self.value = try FHIRPrimitive(from: _container, forKey: .value, auxiliaryKey: ._value) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try op.encode(on: &_container, forKey: .op, auxiliaryKey: ._op) + try property.encode(on: &_container, forKey: .property, auxiliaryKey: ._property) + try value.encode(on: &_container, forKey: .value, auxiliaryKey: ._value) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ValueSetComposeIncludeFilter else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return op == _other.op + && property == _other.property + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(op) + hasher.combine(property) + hasher.combine(value) + } +} + +/** + Used when the value set is "expanded". + + A value set can also be "expanded", where the value set is turned into a simple collection of enumerated codes. This + element holds the expansion, if it has been performed. + */ +open class ValueSetExpansion: BackboneElement { + + /// Uniquely identifies this expansion + public var identifier: FHIRPrimitive + + /// Time ValueSet expansion happened + public var timestamp: FHIRPrimitive + + /// Total number of codes in the expansion + public var total: FHIRPrimitive? + + /// Offset at which this resource starts + public var offset: FHIRPrimitive? + + /// Parameter that controlled the expansion process + public var parameter: [ValueSetExpansionParameter]? + + /// Codes in the value set + public var contains: [ValueSetExpansionContains]? + + /// Designated initializer taking all required properties + public init(identifier: FHIRPrimitive, timestamp: FHIRPrimitive) { + self.identifier = identifier + self.timestamp = timestamp + super.init() + } + + /// Convenience initializer + public convenience init( + contains: [ValueSetExpansionContains]? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: FHIRPrimitive, + modifierExtension: [Extension]? = nil, + offset: FHIRPrimitive? = nil, + parameter: [ValueSetExpansionParameter]? = nil, + timestamp: FHIRPrimitive, + total: FHIRPrimitive? = nil) + { + self.init(identifier: identifier, timestamp: timestamp) + self.contains = contains + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.offset = offset + self.parameter = parameter + self.total = total + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case contains + case identifier; case _identifier + case offset; case _offset + case parameter + case timestamp; case _timestamp + case total; case _total + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.contains = try [ValueSetExpansionContains](from: _container, forKeyIfPresent: .contains) + self.identifier = try FHIRPrimitive(from: _container, forKey: .identifier, auxiliaryKey: ._identifier) + self.offset = try FHIRPrimitive(from: _container, forKeyIfPresent: .offset, auxiliaryKey: ._offset) + self.parameter = try [ValueSetExpansionParameter](from: _container, forKeyIfPresent: .parameter) + self.timestamp = try FHIRPrimitive(from: _container, forKey: .timestamp, auxiliaryKey: ._timestamp) + self.total = try FHIRPrimitive(from: _container, forKeyIfPresent: .total, auxiliaryKey: ._total) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try contains?.encode(on: &_container, forKey: .contains) + try identifier.encode(on: &_container, forKey: .identifier, auxiliaryKey: ._identifier) + try offset?.encode(on: &_container, forKey: .offset, auxiliaryKey: ._offset) + try parameter?.encode(on: &_container, forKey: .parameter) + try timestamp.encode(on: &_container, forKey: .timestamp, auxiliaryKey: ._timestamp) + try total?.encode(on: &_container, forKey: .total, auxiliaryKey: ._total) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ValueSetExpansion else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return contains == _other.contains + && identifier == _other.identifier + && offset == _other.offset + && parameter == _other.parameter + && timestamp == _other.timestamp + && total == _other.total + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(contains) + hasher.combine(identifier) + hasher.combine(offset) + hasher.combine(parameter) + hasher.combine(timestamp) + hasher.combine(total) + } +} + +/** + Codes in the value set. + + The codes that are contained in the value set expansion. + */ +open class ValueSetExpansionContains: BackboneElement { + + /// System value for the code + public var system: FHIRPrimitive? + + /// If user cannot select this entry + public var abstract: FHIRPrimitive? + + /// If concept is inactive in the code system + public var inactive: FHIRPrimitive? + + /// Version in which this code/display is defined + public var version: FHIRPrimitive? + + /// Code - if blank, this is not a selectable code + public var code: FHIRPrimitive? + + /// User display for the concept + public var display: FHIRPrimitive? + + /// Additional representations for this item + public var designation: [ValueSetComposeIncludeConceptDesignation]? + + /// Codes contained under this entry + public var contains: [ValueSetExpansionContains]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + abstract: FHIRPrimitive? = nil, + code: FHIRPrimitive? = nil, + contains: [ValueSetExpansionContains]? = nil, + designation: [ValueSetComposeIncludeConceptDesignation]? = nil, + display: FHIRPrimitive? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + inactive: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + system: FHIRPrimitive? = nil, + version: FHIRPrimitive? = nil) + { + self.init() + self.abstract = abstract + self.code = code + self.contains = contains + self.designation = designation + self.display = display + self.`extension` = `extension` + self.id = id + self.inactive = inactive + self.modifierExtension = modifierExtension + self.system = system + self.version = version + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case abstract; case _abstract + case code; case _code + case contains + case designation + case display; case _display + case inactive; case _inactive + case system; case _system + case version; case _version + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.abstract = try FHIRPrimitive(from: _container, forKeyIfPresent: .abstract, auxiliaryKey: ._abstract) + self.code = try FHIRPrimitive(from: _container, forKeyIfPresent: .code, auxiliaryKey: ._code) + self.contains = try [ValueSetExpansionContains](from: _container, forKeyIfPresent: .contains) + self.designation = try [ValueSetComposeIncludeConceptDesignation](from: _container, forKeyIfPresent: .designation) + self.display = try FHIRPrimitive(from: _container, forKeyIfPresent: .display, auxiliaryKey: ._display) + self.inactive = try FHIRPrimitive(from: _container, forKeyIfPresent: .inactive, auxiliaryKey: ._inactive) + self.system = try FHIRPrimitive(from: _container, forKeyIfPresent: .system, auxiliaryKey: ._system) + self.version = try FHIRPrimitive(from: _container, forKeyIfPresent: .version, auxiliaryKey: ._version) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try abstract?.encode(on: &_container, forKey: .abstract, auxiliaryKey: ._abstract) + try code?.encode(on: &_container, forKey: .code, auxiliaryKey: ._code) + try contains?.encode(on: &_container, forKey: .contains) + try designation?.encode(on: &_container, forKey: .designation) + try display?.encode(on: &_container, forKey: .display, auxiliaryKey: ._display) + try inactive?.encode(on: &_container, forKey: .inactive, auxiliaryKey: ._inactive) + try system?.encode(on: &_container, forKey: .system, auxiliaryKey: ._system) + try version?.encode(on: &_container, forKey: .version, auxiliaryKey: ._version) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ValueSetExpansionContains else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return abstract == _other.abstract + && code == _other.code + && contains == _other.contains + && designation == _other.designation + && display == _other.display + && inactive == _other.inactive + && system == _other.system + && version == _other.version + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(abstract) + hasher.combine(code) + hasher.combine(contains) + hasher.combine(designation) + hasher.combine(display) + hasher.combine(inactive) + hasher.combine(system) + hasher.combine(version) + } +} + +/** + Parameter that controlled the expansion process. + + A parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to + check whether the expansion is suitable for a particular purpose, or to pick the correct expansion. + */ +open class ValueSetExpansionParameter: BackboneElement { + + /// All possible types for "value[x]" + public enum ValueX: Hashable { + case boolean(FHIRPrimitive) + case code(FHIRPrimitive) + case decimal(FHIRPrimitive) + case integer(FHIRPrimitive) + case string(FHIRPrimitive) + case uri(FHIRPrimitive) + } + + /// Name as assigned by the server + public var name: FHIRPrimitive + + /// Value of the named parameter + /// One of `value[x]` + public var value: ValueX? + + /// Designated initializer taking all required properties + public init(name: FHIRPrimitive) { + self.name = name + super.init() + } + + /// Convenience initializer + public convenience init( + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + name: FHIRPrimitive, + value: ValueX? = nil) + { + self.init(name: name) + self.`extension` = `extension` + self.id = id + self.modifierExtension = modifierExtension + self.value = value + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case name; case _name + case valueBoolean; case _valueBoolean + case valueCode; case _valueCode + case valueDecimal; case _valueDecimal + case valueInteger; case _valueInteger + case valueString; case _valueString + case valueUri; case _valueUri + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.name = try FHIRPrimitive(from: _container, forKey: .name, auxiliaryKey: ._name) + var _t_value: ValueX? = nil + if let valueString = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueString, auxiliaryKey: ._valueString) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueString, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .string(valueString) + } + if let valueBoolean = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueBoolean, auxiliaryKey: ._valueBoolean) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueBoolean, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .boolean(valueBoolean) + } + if let valueInteger = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueInteger, auxiliaryKey: ._valueInteger) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueInteger, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .integer(valueInteger) + } + if let valueDecimal = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueDecimal, auxiliaryKey: ._valueDecimal) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueDecimal, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .decimal(valueDecimal) + } + if let valueUri = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueUri, auxiliaryKey: ._valueUri) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueUri, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .uri(valueUri) + } + if let valueCode = try FHIRPrimitive(from: _container, forKeyIfPresent: .valueCode, auxiliaryKey: ._valueCode) { + if _t_value != nil { + throw DecodingError.dataCorruptedError(forKey: .valueCode, in: _container, debugDescription: "More than one value provided for \"value\"") + } + _t_value = .code(valueCode) + } + self.value = _t_value + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try name.encode(on: &_container, forKey: .name, auxiliaryKey: ._name) + if let _enum = value { + switch _enum { + case .string(let _value): + try _value.encode(on: &_container, forKey: .valueString, auxiliaryKey: ._valueString) + case .boolean(let _value): + try _value.encode(on: &_container, forKey: .valueBoolean, auxiliaryKey: ._valueBoolean) + case .integer(let _value): + try _value.encode(on: &_container, forKey: .valueInteger, auxiliaryKey: ._valueInteger) + case .decimal(let _value): + try _value.encode(on: &_container, forKey: .valueDecimal, auxiliaryKey: ._valueDecimal) + case .uri(let _value): + try _value.encode(on: &_container, forKey: .valueUri, auxiliaryKey: ._valueUri) + case .code(let _value): + try _value.encode(on: &_container, forKey: .valueCode, auxiliaryKey: ._valueCode) + } + } + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? ValueSetExpansionParameter else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return name == _other.name + && value == _other.value + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(name) + hasher.combine(value) + } +} diff --git a/Sources/ModelsSTU3/VisionPrescription.swift b/Sources/ModelsSTU3/VisionPrescription.swift new file mode 100644 index 0000000..1afda72 --- /dev/null +++ b/Sources/ModelsSTU3/VisionPrescription.swift @@ -0,0 +1,412 @@ +// +// VisionPrescription.swift +// HealthSoftware +// +// Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/VisionPrescription) +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import FMCore + +/** + Prescription for vision correction products for a patient. + + An authorization for the supply of glasses and/or contact lenses to a patient. + */ +open class VisionPrescription: DomainResource { + + override open class var resourceType: ResourceType { return .visionPrescription } + + /// All possible types for "reason[x]" + public enum ReasonX: Hashable { + case codeableConcept(CodeableConcept) + case reference(Reference) + } + + /// Business identifier + public var identifier: [Identifier]? + + /// active | cancelled | draft | entered-in-error + public var status: FHIRPrimitive? + + /// Who prescription is for + public var patient: Reference? + + /// Created during encounter / admission / stay + public var encounter: Reference? + + /// When prescription was authorized + public var dateWritten: FHIRPrimitive? + + /// Who authorizes the vision product + public var prescriber: Reference? + + /// Reason or indication for writing the prescription + /// One of `reason[x]` + public var reason: ReasonX? + + /// Vision supply authorization + public var dispense: [VisionPrescriptionDispense]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + contained: [ResourceProxy]? = nil, + dateWritten: FHIRPrimitive? = nil, + dispense: [VisionPrescriptionDispense]? = nil, + encounter: Reference? = nil, + `extension`: [Extension]? = nil, + id: FHIRPrimitive? = nil, + identifier: [Identifier]? = nil, + implicitRules: FHIRPrimitive? = nil, + language: FHIRPrimitive? = nil, + meta: Meta? = nil, + modifierExtension: [Extension]? = nil, + patient: Reference? = nil, + prescriber: Reference? = nil, + reason: ReasonX? = nil, + status: FHIRPrimitive? = nil, + text: Narrative? = nil) + { + self.init() + self.contained = contained + self.dateWritten = dateWritten + self.dispense = dispense + self.encounter = encounter + self.`extension` = `extension` + self.id = id + self.identifier = identifier + self.implicitRules = implicitRules + self.language = language + self.meta = meta + self.modifierExtension = modifierExtension + self.patient = patient + self.prescriber = prescriber + self.reason = reason + self.status = status + self.text = text + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case dateWritten; case _dateWritten + case dispense + case encounter + case identifier + case patient + case prescriber + case reasonCodeableConcept + case reasonReference + case status; case _status + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.dateWritten = try FHIRPrimitive(from: _container, forKeyIfPresent: .dateWritten, auxiliaryKey: ._dateWritten) + self.dispense = try [VisionPrescriptionDispense](from: _container, forKeyIfPresent: .dispense) + self.encounter = try Reference(from: _container, forKeyIfPresent: .encounter) + self.identifier = try [Identifier](from: _container, forKeyIfPresent: .identifier) + self.patient = try Reference(from: _container, forKeyIfPresent: .patient) + self.prescriber = try Reference(from: _container, forKeyIfPresent: .prescriber) + var _t_reason: ReasonX? = nil + if let reasonCodeableConcept = try CodeableConcept(from: _container, forKeyIfPresent: .reasonCodeableConcept) { + if _t_reason != nil { + throw DecodingError.dataCorruptedError(forKey: .reasonCodeableConcept, in: _container, debugDescription: "More than one value provided for \"reason\"") + } + _t_reason = .codeableConcept(reasonCodeableConcept) + } + if let reasonReference = try Reference(from: _container, forKeyIfPresent: .reasonReference) { + if _t_reason != nil { + throw DecodingError.dataCorruptedError(forKey: .reasonReference, in: _container, debugDescription: "More than one value provided for \"reason\"") + } + _t_reason = .reference(reasonReference) + } + self.reason = _t_reason + self.status = try FHIRPrimitive(from: _container, forKeyIfPresent: .status, auxiliaryKey: ._status) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try dateWritten?.encode(on: &_container, forKey: .dateWritten, auxiliaryKey: ._dateWritten) + try dispense?.encode(on: &_container, forKey: .dispense) + try encounter?.encode(on: &_container, forKey: .encounter) + try identifier?.encode(on: &_container, forKey: .identifier) + try patient?.encode(on: &_container, forKey: .patient) + try prescriber?.encode(on: &_container, forKey: .prescriber) + if let _enum = reason { + switch _enum { + case .codeableConcept(let _value): + try _value.encode(on: &_container, forKey: .reasonCodeableConcept) + case .reference(let _value): + try _value.encode(on: &_container, forKey: .reasonReference) + } + } + try status?.encode(on: &_container, forKey: .status, auxiliaryKey: ._status) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? VisionPrescription else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return dateWritten == _other.dateWritten + && dispense == _other.dispense + && encounter == _other.encounter + && identifier == _other.identifier + && patient == _other.patient + && prescriber == _other.prescriber + && reason == _other.reason + && status == _other.status + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(dateWritten) + hasher.combine(dispense) + hasher.combine(encounter) + hasher.combine(identifier) + hasher.combine(patient) + hasher.combine(prescriber) + hasher.combine(reason) + hasher.combine(status) + } +} + +/** + Vision supply authorization. + + Deals with details of the dispense part of the supply specification. + */ +open class VisionPrescriptionDispense: BackboneElement { + + /// Product to be supplied + public var product: CodeableConcept? + + /// The eye for which the lens applies. + public var eye: FHIRPrimitive? + + /// Lens sphere + public var sphere: FHIRPrimitive? + + /// Lens cylinder + public var cylinder: FHIRPrimitive? + + /// Lens axis + public var axis: FHIRPrimitive? + + /// Lens prism + public var prism: FHIRPrimitive? + + /// The relative base, or reference lens edge, for the prism. + public var base: FHIRPrimitive? + + /// Lens add + public var add: FHIRPrimitive? + + /// Contact lens power + public var power: FHIRPrimitive? + + /// Contact lens back curvature + public var backCurve: FHIRPrimitive? + + /// Contact lens diameter + public var diameter: FHIRPrimitive? + + /// Lens wear duration + public var duration: Quantity? + + /// Color required + public var color: FHIRPrimitive? + + /// Brand required + public var brand: FHIRPrimitive? + + /// Notes for coatings + public var note: [Annotation]? + + /// Designated initializer taking all required properties + override public init() { + super.init() + } + + /// Convenience initializer + public convenience init( + add: FHIRPrimitive? = nil, + axis: FHIRPrimitive? = nil, + backCurve: FHIRPrimitive? = nil, + base: FHIRPrimitive? = nil, + brand: FHIRPrimitive? = nil, + color: FHIRPrimitive? = nil, + cylinder: FHIRPrimitive? = nil, + diameter: FHIRPrimitive? = nil, + duration: Quantity? = nil, + `extension`: [Extension]? = nil, + eye: FHIRPrimitive? = nil, + id: FHIRPrimitive? = nil, + modifierExtension: [Extension]? = nil, + note: [Annotation]? = nil, + power: FHIRPrimitive? = nil, + prism: FHIRPrimitive? = nil, + product: CodeableConcept? = nil, + sphere: FHIRPrimitive? = nil) + { + self.init() + self.add = add + self.axis = axis + self.backCurve = backCurve + self.base = base + self.brand = brand + self.color = color + self.cylinder = cylinder + self.diameter = diameter + self.duration = duration + self.`extension` = `extension` + self.eye = eye + self.id = id + self.modifierExtension = modifierExtension + self.note = note + self.power = power + self.prism = prism + self.product = product + self.sphere = sphere + } + + // MARK: - Codable + + private enum CodingKeys: String, CodingKey { + case add; case _add + case axis; case _axis + case backCurve; case _backCurve + case base; case _base + case brand; case _brand + case color; case _color + case cylinder; case _cylinder + case diameter; case _diameter + case duration + case eye; case _eye + case note + case power; case _power + case prism; case _prism + case product + case sphere; case _sphere + } + + /// Initializer for Decodable + public required init(from decoder: Decoder) throws { + let _container = try decoder.container(keyedBy: CodingKeys.self) + + // Decode all our properties + self.add = try FHIRPrimitive(from: _container, forKeyIfPresent: .add, auxiliaryKey: ._add) + self.axis = try FHIRPrimitive(from: _container, forKeyIfPresent: .axis, auxiliaryKey: ._axis) + self.backCurve = try FHIRPrimitive(from: _container, forKeyIfPresent: .backCurve, auxiliaryKey: ._backCurve) + self.base = try FHIRPrimitive(from: _container, forKeyIfPresent: .base, auxiliaryKey: ._base) + self.brand = try FHIRPrimitive(from: _container, forKeyIfPresent: .brand, auxiliaryKey: ._brand) + self.color = try FHIRPrimitive(from: _container, forKeyIfPresent: .color, auxiliaryKey: ._color) + self.cylinder = try FHIRPrimitive(from: _container, forKeyIfPresent: .cylinder, auxiliaryKey: ._cylinder) + self.diameter = try FHIRPrimitive(from: _container, forKeyIfPresent: .diameter, auxiliaryKey: ._diameter) + self.duration = try Quantity(from: _container, forKeyIfPresent: .duration) + self.eye = try FHIRPrimitive(from: _container, forKeyIfPresent: .eye, auxiliaryKey: ._eye) + self.note = try [Annotation](from: _container, forKeyIfPresent: .note) + self.power = try FHIRPrimitive(from: _container, forKeyIfPresent: .power, auxiliaryKey: ._power) + self.prism = try FHIRPrimitive(from: _container, forKeyIfPresent: .prism, auxiliaryKey: ._prism) + self.product = try CodeableConcept(from: _container, forKeyIfPresent: .product) + self.sphere = try FHIRPrimitive(from: _container, forKeyIfPresent: .sphere, auxiliaryKey: ._sphere) + try super.init(from: decoder) + } + + /// Encodable + public override func encode(to encoder: Encoder) throws { + var _container = encoder.container(keyedBy: CodingKeys.self) + + // Encode all our properties + try add?.encode(on: &_container, forKey: .add, auxiliaryKey: ._add) + try axis?.encode(on: &_container, forKey: .axis, auxiliaryKey: ._axis) + try backCurve?.encode(on: &_container, forKey: .backCurve, auxiliaryKey: ._backCurve) + try base?.encode(on: &_container, forKey: .base, auxiliaryKey: ._base) + try brand?.encode(on: &_container, forKey: .brand, auxiliaryKey: ._brand) + try color?.encode(on: &_container, forKey: .color, auxiliaryKey: ._color) + try cylinder?.encode(on: &_container, forKey: .cylinder, auxiliaryKey: ._cylinder) + try diameter?.encode(on: &_container, forKey: .diameter, auxiliaryKey: ._diameter) + try duration?.encode(on: &_container, forKey: .duration) + try eye?.encode(on: &_container, forKey: .eye, auxiliaryKey: ._eye) + try note?.encode(on: &_container, forKey: .note) + try power?.encode(on: &_container, forKey: .power, auxiliaryKey: ._power) + try prism?.encode(on: &_container, forKey: .prism, auxiliaryKey: ._prism) + try product?.encode(on: &_container, forKey: .product) + try sphere?.encode(on: &_container, forKey: .sphere, auxiliaryKey: ._sphere) + try super.encode(to: encoder) + } + + // MARK: - Equatable & Hashable + + public override func isEqual(to _other: Any?) -> Bool { + guard let _other = _other as? VisionPrescriptionDispense else { + return false + } + guard super.isEqual(to: _other) else { + return false + } + return add == _other.add + && axis == _other.axis + && backCurve == _other.backCurve + && base == _other.base + && brand == _other.brand + && color == _other.color + && cylinder == _other.cylinder + && diameter == _other.diameter + && duration == _other.duration + && eye == _other.eye + && note == _other.note + && power == _other.power + && prism == _other.prism + && product == _other.product + && sphere == _other.sphere + } + + public override func hash(into hasher: inout Hasher) { + super.hash(into: &hasher) + hasher.combine(add) + hasher.combine(axis) + hasher.combine(backCurve) + hasher.combine(base) + hasher.combine(brand) + hasher.combine(color) + hasher.combine(cylinder) + hasher.combine(diameter) + hasher.combine(duration) + hasher.combine(eye) + hasher.combine(note) + hasher.combine(power) + hasher.combine(prism) + hasher.combine(product) + hasher.combine(sphere) + } +} diff --git a/Tests/ModelTests/ModelsBuildTests.swift b/Tests/ModelTests/ModelsBuildTests.swift new file mode 100644 index 0000000..33f8c92 --- /dev/null +++ b/Tests/ModelTests/ModelsBuildTests.swift @@ -0,0 +1,91 @@ +// +// ModelsBuildTests.swift +// HealthSoftware +// +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import XCTest +import ModelsBuild + +class ModelsBuildTests: XCTestCase { + + @available(iOS 13.0, *) + func testGroupResourceDecodeEncode() throws { + let string = +""" +{ + "resourceType": "Group", + "id": "101", + "text": { + "status": "additional", + "div": "

Herd of 25 horses

Gender: mixed

Owner: John Smith

" + }, + "type": "animal", + "actual": true, + "code": { + "text": "Horse" + }, + "name": "John's herd", + "quantity": 25, + "characteristic": [ + { + "code": { + "text": "gender" + }, + "valueCodeableConcept": { + "text": "mixed" + }, + "exclude": false + }, + { + "code": { + "text": "owner" + }, + "valueCodeableConcept": { + "text": "John Smith" + }, + "exclude": false + } + ] +} +""" + guard let data = string.data(using: .utf8) else { + throw TestError.failed("encoding string to UTF8 data") + } + + let decoder = JSONDecoder() + let group = try decoder.decode(Group.self, from: data) + XCTAssertEqual(type(of: group).resourceType, .group) + XCTAssertEqual(group.id, "101") + XCTAssertEqual(group.type.value, .animal) + XCTAssertEqual(group.actual, true) + XCTAssertEqual(group.quantity, 25) + XCTAssertEqual(group.code?.text, "Horse") + XCTAssertEqual(group.characteristic?.count, 2) + + let encoder = JSONEncoder() + encoder.outputFormatting = .withoutEscapingSlashes + let encoded = try encoder.encode(group) + guard let encodedString = String(data: encoded, encoding: .utf8) else { + throw TestError.failed("decoding UTF8 data to string") + } + XCTAssertTrue(encodedString.contains("\"id\":\"101\"")) + XCTAssertTrue(encodedString.contains("\"type\":\"animal\"")) + XCTAssertTrue(encodedString.contains("\"actual\":true")) + XCTAssertTrue(encodedString.contains("\"quantity\":25")) + XCTAssertTrue(encodedString.contains("\"code\":{\"text\":\"Horse\"}")) + XCTAssertTrue(encodedString.contains("\"characteristic\":[")) + } +} diff --git a/Tests/ModelTests/ModelsDSTU2Tests.swift b/Tests/ModelTests/ModelsDSTU2Tests.swift new file mode 100644 index 0000000..013d512 --- /dev/null +++ b/Tests/ModelTests/ModelsDSTU2Tests.swift @@ -0,0 +1,91 @@ +// +// ModelsDSTU2Tests.swift +// HealthSoftware +// +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import XCTest +import ModelsDSTU2 + +class ModelsDSTU2Tests: XCTestCase { + + @available(iOS 13.0, *) + func testGroupResourceDecodeEncode() throws { + let string = +""" +{ + "resourceType": "Group", + "id": "101", + "text": { + "status": "additional", + "div": "

Herd of 25 horses

Gender: mixed

Owner: John Smith

" + }, + "type": "animal", + "actual": true, + "code": { + "text": "Horse" + }, + "name": "John's herd", + "quantity": 25, + "characteristic": [ + { + "code": { + "text": "gender" + }, + "valueCodeableConcept": { + "text": "mixed" + }, + "exclude": false + }, + { + "code": { + "text": "owner" + }, + "valueCodeableConcept": { + "text": "John Smith" + }, + "exclude": false + } + ] +} +""" + guard let data = string.data(using: .utf8) else { + throw TestError.failed("encoding string to UTF8 data") + } + + let decoder = JSONDecoder() + let group = try decoder.decode(Group.self, from: data) + XCTAssertEqual(type(of: group).resourceType, .group) + XCTAssertEqual(group.id, "101") + XCTAssertEqual(group.type.value, .animal) + XCTAssertEqual(group.actual, true) + XCTAssertEqual(group.quantity, 25) + XCTAssertEqual(group.code?.text, "Horse") + XCTAssertEqual(group.characteristic?.count, 2) + + let encoder = JSONEncoder() + encoder.outputFormatting = .withoutEscapingSlashes + let encoded = try encoder.encode(group) + guard let encodedString = String(data: encoded, encoding: .utf8) else { + throw TestError.failed("decoding UTF8 data to string") + } + XCTAssertTrue(encodedString.contains("\"id\":\"101\"")) + XCTAssertTrue(encodedString.contains("\"type\":\"animal\"")) + XCTAssertTrue(encodedString.contains("\"actual\":true")) + XCTAssertTrue(encodedString.contains("\"quantity\":25")) + XCTAssertTrue(encodedString.contains("\"code\":{\"text\":\"Horse\"}")) + XCTAssertTrue(encodedString.contains("\"characteristic\":[")) + } +} diff --git a/Tests/ModelTests/ModelsR4Tests.swift b/Tests/ModelTests/ModelsR4Tests.swift new file mode 100644 index 0000000..51a4cf5 --- /dev/null +++ b/Tests/ModelTests/ModelsR4Tests.swift @@ -0,0 +1,91 @@ +// +// ModelsR4Tests.swift +// HealthSoftware +// +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import XCTest +import ModelsR4 + +class ModelsR4Tests: XCTestCase { + + @available(iOS 13.0, *) + func testGroupResourceDecodeEncode() throws { + let string = +""" +{ + "resourceType": "Group", + "id": "101", + "text": { + "status": "additional", + "div": "

Herd of 25 horses

Gender: mixed

Owner: John Smith

" + }, + "type": "animal", + "actual": true, + "code": { + "text": "Horse" + }, + "name": "John's herd", + "quantity": 25, + "characteristic": [ + { + "code": { + "text": "gender" + }, + "valueCodeableConcept": { + "text": "mixed" + }, + "exclude": false + }, + { + "code": { + "text": "owner" + }, + "valueCodeableConcept": { + "text": "John Smith" + }, + "exclude": false + } + ] +} +""" + guard let data = string.data(using: .utf8) else { + throw TestError.failed("encoding string to UTF8 data") + } + + let decoder = JSONDecoder() + let group = try decoder.decode(Group.self, from: data) + XCTAssertEqual(type(of: group).resourceType, .group) + XCTAssertEqual(group.id, "101") + XCTAssertEqual(group.type.value, .animal) + XCTAssertEqual(group.actual, true) + XCTAssertEqual(group.quantity, 25) + XCTAssertEqual(group.code?.text, "Horse") + XCTAssertEqual(group.characteristic?.count, 2) + + let encoder = JSONEncoder() + encoder.outputFormatting = .withoutEscapingSlashes + let encoded = try encoder.encode(group) + guard let encodedString = String(data: encoded, encoding: .utf8) else { + throw TestError.failed("decoding UTF8 data to string") + } + XCTAssertTrue(encodedString.contains("\"id\":\"101\"")) + XCTAssertTrue(encodedString.contains("\"type\":\"animal\"")) + XCTAssertTrue(encodedString.contains("\"actual\":true")) + XCTAssertTrue(encodedString.contains("\"quantity\":25")) + XCTAssertTrue(encodedString.contains("\"code\":{\"text\":\"Horse\"}")) + XCTAssertTrue(encodedString.contains("\"characteristic\":[")) + } +} diff --git a/Tests/ModelTests/ModelsSTU3Tests.swift b/Tests/ModelTests/ModelsSTU3Tests.swift new file mode 100644 index 0000000..e59bb2d --- /dev/null +++ b/Tests/ModelTests/ModelsSTU3Tests.swift @@ -0,0 +1,91 @@ +// +// ModelsSTU3Tests.swift +// HealthSoftware +// +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import XCTest +import ModelsSTU3 + +class ModelsSTU3Tests: XCTestCase { + + @available(iOS 13.0, *) + func testGroupResourceDecodeEncode() throws { + let string = +""" +{ + "resourceType": "Group", + "id": "101", + "text": { + "status": "additional", + "div": "

Herd of 25 horses

Gender: mixed

Owner: John Smith

" + }, + "type": "animal", + "actual": true, + "code": { + "text": "Horse" + }, + "name": "John's herd", + "quantity": 25, + "characteristic": [ + { + "code": { + "text": "gender" + }, + "valueCodeableConcept": { + "text": "mixed" + }, + "exclude": false + }, + { + "code": { + "text": "owner" + }, + "valueCodeableConcept": { + "text": "John Smith" + }, + "exclude": false + } + ] +} +""" + guard let data = string.data(using: .utf8) else { + throw TestError.failed("encoding string to UTF8 data") + } + + let decoder = JSONDecoder() + let group = try decoder.decode(Group.self, from: data) + XCTAssertEqual(type(of: group).resourceType, .group) + XCTAssertEqual(group.id, "101") + XCTAssertEqual(group.type.value, .animal) + XCTAssertEqual(group.actual, true) + XCTAssertEqual(group.quantity, 25) + XCTAssertEqual(group.code?.text, "Horse") + XCTAssertEqual(group.characteristic?.count, 2) + + let encoder = JSONEncoder() + encoder.outputFormatting = .withoutEscapingSlashes + let encoded = try encoder.encode(group) + guard let encodedString = String(data: encoded, encoding: .utf8) else { + throw TestError.failed("decoding UTF8 data to string") + } + XCTAssertTrue(encodedString.contains("\"id\":\"101\"")) + XCTAssertTrue(encodedString.contains("\"type\":\"animal\"")) + XCTAssertTrue(encodedString.contains("\"actual\":true")) + XCTAssertTrue(encodedString.contains("\"quantity\":25")) + XCTAssertTrue(encodedString.contains("\"code\":{\"text\":\"Horse\"}")) + XCTAssertTrue(encodedString.contains("\"characteristic\":[")) + } +} diff --git a/Tests/ModelTests/UnittestError.swift b/Tests/ModelTests/UnittestError.swift new file mode 100644 index 0000000..afac4fa --- /dev/null +++ b/Tests/ModelTests/UnittestError.swift @@ -0,0 +1,21 @@ +// +// UnittestError.swift +// HealthSoftware +// +// Copyright 2020 Apple Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +enum TestError: Error { + case failed(String) +} diff --git a/Tests/PrimitiveTests/PrimitiveConstructionTests.swift b/Tests/PrimitiveTests/PrimitiveConstructionTests.swift index 658a19c..b8a24cf 100644 --- a/Tests/PrimitiveTests/PrimitiveConstructionTests.swift +++ b/Tests/PrimitiveTests/PrimitiveConstructionTests.swift @@ -353,7 +353,7 @@ class PrimitiveConstructionTests: XCTestCase { // MARK: - Utilities - func assertGroup(group: Group, file: StaticString = #file, line: UInt = #line) { + func assertGroup(group: Group, file: StaticString = #filePath, line: UInt = #line) { XCTAssertEqual(group.type, GroupType.person.asPrimitive(), file: file, line: line) XCTAssertTrue(group.actual.value?.bool ?? false, file: file, line: line) XCTAssertFalse(group.active?.value?.bool ?? true, file: file, line: line)